Error in code for plot

4 vues (au cours des 30 derniers jours)
Cameron Paterson
Cameron Paterson le 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

Réponse acceptée

Steven Lord
Steven Lord le 7 Nov 2021
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.

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by