How do I merge 2 figures from 2 different programs in a single figure ?

18 vues (au cours des 30 derniers jours)
parag gupta
parag gupta le 18 Juil 2019
Commenté : parag gupta le 19 Juil 2019
Hi! Please find attached a file containg code. I got two graphs from two different files and want to merge them into one graph. (so that I can easily compare the graphs)
Could someone tell me how can to merge two graphs from different files?
Thanks :)
  1 commentaire
KALYAN ACHARJYA
KALYAN ACHARJYA le 18 Juil 2019
Modifié(e) : KALYAN ACHARJYA le 18 Juil 2019
Is their any issue?
You can use functions call to paas the plot variables to main script and do the same.

Connectez-vous pour commenter.

Réponse acceptée

Geoff Hayes
Geoff Hayes le 18 Juil 2019
Modifié(e) : Geoff Hayes le 18 Juil 2019
parag - you could merge the code from the runsub.m and runrub.m files into a single script or function to get something like
function plotsWithAndWithoutAntibodies
close all;
%without antibodies
options = ddeset('RelTol',1e-5,'AbsTol',1e-8,'InitialY',[20,0,0,0]);
sol = dde23('funtryp',14,[0,0,0,0],[0,1500],options);
figure();
plot(sol.x,sol.y(1,:),'r','LineWidth',2);
xlabel('time t');
ylabel('v1(t)');
% with antibodies
options = ddeset('RelTol',1e-5,'AbsTol',1e-8,'InitialY',[20,0,0,0,0]);
sol = dde23('funtryp1',100,[0,0,0,0,0],[0,1500],options);
hold on;
plot(sol.x,sol.y(1,:),'b','LineWidth',2);
You'd probably want to add a legend to distinguish between thet two.
The problem with the two scripts is that each one calls "clear all" and "close all" and so you would lose the plot that has already been drawn.
  5 commentaires
Geoff Hayes
Geoff Hayes le 18 Juil 2019
Please post your code and how you are calling it.
parag gupta
parag gupta le 19 Juil 2019
thanks :) got the right output

Connectez-vous pour commenter.

Plus de réponses (0)

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!

Translated by