Error in code for plot

조회 수: 4 (최근 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 CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by