필터 지우기
필터 지우기

Why isn't my first line being plotted?

조회 수: 9 (최근 30일)
Kyle Donk
Kyle Donk 2020년 1월 31일
편집: Stephen23 2020년 1월 31일
On this quiz, I have to graph two lines and only f1 is showing up on my graph. The first graph is supposed to have 100 points between the values of zero and ten. As of right now, the fplot is working fine, but the regular one isn't. Does anyone see anything that is prevent the regular plot from being plotted?
x=0:100:10;
y=10*exp(-0.5*x)*cos(6*x);
plot(x,y,'r')
f1=@(x) 20*exp(-0.5*x)*cos(6*x);
hold on
plot(x,y,'r')
fplot (f1,[0,10],'g')
xlabel('x axis')
ylabel('y axis')
hold off

채택된 답변

Stephen23
Stephen23 2020년 1월 31일
편집: Stephen23 2020년 1월 31일
"Does anyone see anything that is prevent the regular plot from being plotted?"
Here are two bugs on the first two lines:
x=0:100:10; % start:step:end -> how many points are there between 0 and 10 with step of 100?
y=10*exp(-0.5*x)*cos(6*x); % you used MTIMES but you should use TIMES.
To use MATLAB you need to know the difference between array and matrix operations:

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by