Multiple plots not working on the simulink spring mass model

1 visualización (últimos 30 días)
R Abhinandan
R Abhinandan el 2 de Sept. de 2021
Comentada: Fangjun Jiang el 2 de Sept. de 2021
In this pdf, page number 39, exericse 2 i tried implementing the same code using the same method but my output graph is like this. I have attachted my simulink file.
%for plotting graph
plot(out.t,out.x)
hold on
B = 8;
sim('second')
plot(out.t,out.x)
B=12;
sim('second')
plot(out.t,out.x)
B = 25;
sim('second')
plot(out.t,out.x)
hold off
%parameters
M=2; %kg
K= 16; %N/m
B=4; % Ns/m

Respuestas (1)

Fangjun Jiang
Fangjun Jiang el 2 de Sept. de 2021
  4 comentarios
R Abhinandan
R Abhinandan el 2 de Sept. de 2021
a=sim('second')
plot(a.simout.t,a.simout.x)
hold on
B = 8;
a=sim('second')
plot(a.simout.t,a.simout.x)
B=12;
a=sim('second')
plot(a.simout.t,a.simout.x)
B = 25;
a=sim('second')
plot(a.simout.t,a.simout.x)
hold off
this is my code and i get "Dot indexing is not supported for variables of this type." i changed my type from arrays to structure with time
Fangjun Jiang
Fangjun Jiang el 2 de Sept. de 2021
Figure out what variable is your saved output. It could depend on your configuration setting, signal logging or ToWorkspace block.

Iniciar sesión para comentar.

Categorías

Más información sobre Programmatic Model Editing en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by