Error in code for plot

1 次查看(过去 30 天)
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

采纳的回答

Steven Lord
Steven Lord 2021-11-7
x=linspace(0,2.*pi,101)
x = 1×101
0 0.0628 0.1257 0.1885 0.2513 0.3142 0.3770 0.4398 0.5027 0.5655 0.6283 0.6912 0.7540 0.8168 0.8796 0.9425 1.0053 1.0681 1.1310 1.1938 1.2566 1.3195 1.3823 1.4451 1.5080 1.5708 1.6336 1.6965 1.7593 1.8221
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)
Error using plot
Invalid data argument.
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 个)

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by