Q:

Write an m-file function called “plotsin” that will graphically demonstrate the difference in plotting the sin function with a different number of points in the range from 0 to 2π

0

Write an m-file function called “plotsin” that will graphically 

demonstrate the difference in plotting the sin function with a different 

number of points in the range from 0 to 2 π. The function will receive 

two arguments, which are the number of points to use in two different 

plots of the sin function. For example, the following call to the 

function:

>> plotsin(5,30)

will result in the following figure window in which the first plot has 5 

points altogether in the range from 0 to 2π, inclusive, and the second 

has 30:

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

plotsin.m

function plotsin(lowp, highp)

x = linspace(0,2*pi,lowp);

y = sin(x);

subplot(2,1,1)

plot(x,y)

title(sprintf('%d points',lowp))

subplot(2,1,2)

x = linspace(0,2*pi,highp);

y = sin(x);

plot(x,y)

title(sprintf('%d points',highp))

end

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now