필터 지우기
필터 지우기

Please Help Debug/ What are the errors?

조회 수: 1 (최근 30일)
Richard Buccacio
Richard Buccacio 2021년 9월 28일
답변: Chunru 2021년 9월 29일
%Plot a function with respect to time
%Variables
y=t^3-6*t^2+3*t+10;
t=-2:0.1:8;
%Plot command and labels
plot(t,y,*r*);
xlabel(time,t);ylabel(y-axis);
title(y=t^3-6*t^2+3*t+10); grid
  댓글 수: 1
per isakson
per isakson 2021년 9월 28일
편집: per isakson 2021년 9월 28일
Is this homework?
There are several mistakes in this code, which you didn't make in the code of your previous question. E.g. see the title, xlabel and ylabel commands.
If you have used Octave, notice that there are some diffences in the syntax.

댓글을 달려면 로그인하십시오.

답변 (1개)

Chunru
Chunru 2021년 9월 29일
t=-2:0.1:8; % define t first, since it is used next
y=t.^3-6*t.^2+3*t+10; % need the element based operation .^
%Plot command and labels
plot(t, y, 'r-');
xlabel('t');
ylabel( 'y');
title('y=t^3-6*t^2+3*t+10');
grid

카테고리

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