I am Trying to Plot 3 plots onto the same graph
1 次查看(过去 30 天)
显示 更早的评论
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.
0 个评论
回答(1 个)
Dave B
2021-10-25
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
plot(t,hb1)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Oceanography and Hydrology 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!