Please Help Debug/ What are the errors?

%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 日

0 投票

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

カテゴリ

タグ

質問済み:

2021 年 9 月 28 日

回答済み:

2021 年 9 月 29 日

Community Treasure Hunt

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

Start Hunting!

Translated by