Plotting 2 scripts on 1 graph
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
i have made 2 codes which solve a problem analytically and numeriacally and now i am trying to dispay this data on one graph. I there a way i can pull data from one script son i can plot all my data in one graph?
Thank you
0 comentarios
Respuestas (1)
Jon
el 22 de Mzo. de 2023
The results of running scripts are saved in the local workspace.
So lets say that inside of script one you calcualate values of variables named t1 and x1, and inside of script two you calculate values of variables named t2 and x2
Then you would run script one, then run script two and then plot using
figure % make a new figure
plot(t1,x1,t2,x2)
You could also make one master script to run the two other scripts so something like
% run first script (produces t1 and x1)
script1
% run second script (produces t2 and x2)
script2
% plot results
figure
plot(t1,x1,t2,x2)
You may also want to consider using functions for the two different analyses and then you can avoid hardcoding the names of the variables output by each script
0 comentarios
Ver también
Categorías
Más información sobre Line Plots 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!