Plotting 2 scripts on 1 graph
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Jon
le 22 Mar 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 commentaires
Voir également
Catégories
En savoir plus sur Line Plots dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!