フィルターのクリア

overlaying 2 plot in one graph

60 ビュー (過去 30 日間)
Pepe
Pepe 2019 年 2 月 27 日
編集済み: Yasasvi Harish Kumar 2019 年 3 月 1 日
Hello,
I am new to Matlab so forgive me if there is very basic question.
I have a matlab script that reads in, reformat and plot acceleration time series.
I would like to overlay two accelerations series in the same graph.
Please see the code below:
function accelPlot()
% plot acceleration time history and response spectra
close all
% load recorded nodal data
acc = load('/home/kowal/OpenSeesPy/SiteResponseAnalysis_layeredColumn/accelerationNS.out');
time = acc(:,1);
% remove time column from data
acc(:,1) = [];
% data descriptors
[nStep, nAcc] = size(acc);
nDOF = 2;
nNode = nAcc/nDOF;
% reshape data
a = reshape(acc, nStep, nDOF, nNode)/9.81;
% plot horizontal acceleration time history at ground surface
figure(1)
plot(time, a(:,1,nNode), '-b','linewidth',1.5)
grid on
box on
xlabel('time (sec)','fontsize',16)
ylabel('acceleration (g)','fontsize',16)
set(gca,'fontsize',14)
print -depsc2 surfaceAccel.eps
I would be really grateful for your help.
Thanks!

採用された回答

Yasasvi Harish Kumar
Yasasvi Harish Kumar 2019 年 2 月 27 日
編集済み: Yasasvi Harish Kumar 2019 年 3 月 1 日
Hi,
You can use the command 'hold on' after your first plot command to have the plot overlay.
Example:
plot(x,y)
hold on
plot(w,z)
Regards
  1 件のコメント
Pepe
Pepe 2019 年 2 月 27 日
Thank you :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDirected Graphs についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by