Help me to plot a graph
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Charuka Kumarasinghe
el 21 de Jun. de 2022
Comentada: Sam Chak
el 22 de Jun. de 2022
x=[0:100:500];
y=3000+x.*250;
y1=y.*400;
How to plot both (x,y) and (x,y1) on one graph with suitable y axis ranges
0 comentarios
Respuesta aceptada
Sam Chak
el 21 de Jun. de 2022
Maybe like this?
x = linspace(0, 100, 501);
y = 3000 + x*250;
yyaxis left
plot(x, y)
ylim([0 4e4])
yyaxis right
plot(x, 400*y)
ylim([0 14e6])
3 comentarios
Sam Chak
el 22 de Jun. de 2022
You are welcome, @Charuka Kumarasinghe. If you find the solution is helpful, please consider accepting ✔ and voting 👍 the Answer. Thanks!
Más respuestas (1)
Ajay Ahuja
el 22 de Jun. de 2022
Thanks Sam for the answer. However, yyaxis left & yyaxis right commands don't seem to work in Simulink block. Any suggestions? Rgds!
1 comentario
Sam Chak
el 22 de Jun. de 2022
Hi @Ajay Ahuja
As far as I know, this left/right y-axis feature is currently not supported in the Simulink Scope.
If you really want to view two signals in one Scope, consider specifying the number of input ports on a Scope block.
For inserting a figure in a technical report, it is recommended that you send the data to Workspace and plot them out using yyaxis in MATLAB.
Ver también
Categorías
Más información sobre Annotations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!