Error in code for plot

1 回表示 (過去 30 日間)
Cameron Paterson
Cameron Paterson 2021 年 11 月 7 日
回答済み: Steven Lord 2021 年 11 月 7 日
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 Center および File ExchangeLine Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by