Error in code for plot
1 view (last 30 days)
Show older comments
Cameron Paterson
on 7 Nov 2021
Answered: Steven Lord
on 7 Nov 2021
x=linspace(0,2.*pi,101)
plot(x,sin(x),'markeredgecolor','r',x,cos(x),'markeredgecolor','g',x,tan(x),'markeredgecolor','b',x,cot(x),'markeredgecolor','c',x,sec(x),'markeredgecolor','m',x,csc(x),'markeredgecolor','y','linewidth',1.5)
ylabel('Trigonometric Function')
xlabel('Angle (\theta)')
legend('southwest')
axis([0 2.*pi -5 5])
grid on
0 Comments
Accepted Answer
Steven Lord
on 7 Nov 2021
x=linspace(0,2.*pi,101)
plot(x,sin(x),'markeredgecolor','r',...
x,cos(x),'markeredgecolor','g',...
x,tan(x),'markeredgecolor','b',...
x,cot(x),'markeredgecolor','c',...
x,sec(x),'markeredgecolor','m',...
x,csc(x),'markeredgecolor','y'...
,'linewidth',1.5)
You cannot put name-value pair arguments in the middle of data inputs. Either make these separate calls to plot (using hold on to put all the lines on the same axes) or call plot with an output argument and set the properties on the handles stored as elements of that output argument.
0 Comments
More Answers (0)
See Also
Categories
Find more on Line Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!