Borrar filtros
Borrar filtros

Please Help Debug/ What are the errors?

1 visualización (últimos 30 días)
Richard Buccacio
Richard Buccacio el 28 de Sept. de 2021
Respondida: Chunru el 29 de Sept. de 2021
%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 comentario
per isakson
per isakson el 28 de Sept. de 2021
Editada: per isakson el 28 de Sept. de 2021
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.

Iniciar sesión para comentar.

Respuestas (1)

Chunru
Chunru el 29 de Sept. de 2021
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

Categorías

Más información sobre Line Plots en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by