I am Trying to Plot 3 plots onto the same graph

1 visualizzazione (ultimi 30 giorni)
John Carroll
John Carroll il 25 Ott 2021
Risposto: Dave B il 25 Ott 2021
I am trying to combine 3 figures into the same plot. My code is as follows:
figure(1);
Vm=5.07; % Calculated on Paper
t = linspace(1,48); % Time over 48 hours
V = Vm*sin((2*pi*t)/(Ttide)); % Velocity Equation
plot(t,V)
figure(2);
E=53; %degrees
t = linspace(1,48); % Time over 48 hours
hb=Ab1*cos(((2*pi*t)/Ttide)-E); %Ocean Tide
plot(t,hb)
figure(3);
t = linspace(1,48);% Time over 48 hours
hb1=a0*cos((2*pi*t)/Ttide)%N0
plot(t,hb1)
I have tried using the "hold on" and 'hold off' functions however was not able to get it to work.

Risposte (1)

Dave B
Dave B il 25 Ott 2021
You can do this with hold on, just drop the calls to figure.
figure(1);
Vm=5.07; % Calculated on Paper
Ttide = 1; % you didn't give us this...
t = linspace(1,48); % Time over 48 hours
V = Vm*sin((2*pi*t)/(Ttide)); % Velocity Equation
plot(t,V)
hold on
E=53; %degrees
t = linspace(1,48); % Time over 48 hours
Ab1 = 1.2; % you didn't give us this
hb=Ab1*cos(((2*pi*t)/Ttide)-E); %Ocean Tide
plot(t,hb)
a0 = 3; % you didn't give us this
t = linspace(1,48);% Time over 48 hours
hb1=a0*cos((2*pi*t)/Ttide)%N0
hb1 = 1×100
3.0000 -2.9623 2.8502 -2.6665 2.4158 -2.1044 1.7402 -1.3322 0.8908 -0.4269 -0.0476 0.5209 -0.9812 1.4168 -1.8168 2.1712 -2.4710 2.7088 -2.8785 2.9759 -2.9985 2.9458 -2.8191 2.6215 -2.3582 2.0355 -1.6618 1.2462 -0.7994 0.3325
plot(t,hb1)

Categorie

Scopri di più su Oceanography and Hydrology in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by