Multiple plots on the same graph

1 回表示 (過去 30 日間)
Siriki Kone
Siriki Kone 2021 年 10 月 24 日
編集済み: Matt J 2021 年 10 月 24 日
Hello!
I know this question have been frequently asked but since i still get an error after trying all the proposed solutions here, i decide to post my problem:
i generate PDF values and i want to plot all of them on the same graph with the same x axis:
Path3='C:\matlab\OutputDateien\DataAnalyse\01_A01\hhe';
P3=strcat(Path3,'\PSDPDFs\06\');
S3=(fullfile(P3,'*.mat'));
AllFiles3=dir(S3);
load('C:\matlab\OutputDateien\tc.mat'); %loading my period vector
figure;
for kk=1:length(AllFiles3) %:numel(AllFiles)
File3=AllFiles3(kk).name;
semilogx(tc,File3);
hold on;
xlabel('Period (s)')
ylabel('Power 10*log10 (m/s^2)/Hz or dB')
title('PSD diagram ')
axis tight
end
hold off
i try to use hold on function after my plot but i get this following error:
Error in color/linetype argument.
Error in PSDplot (line 37)
semilogx(tc,File3);
since i got 500 PDF vectors i think using a loop would be better instead of plotting them like semilogx(tc,PDF1, tc,PDF2, tc,PDF2,...)
tc and PDF have both the same length (113).

採用された回答

Matt J
Matt J 2021 年 10 月 24 日
編集済み: Matt J 2021 年 10 月 24 日
I think the line where you plot is supposed to look like,
semilogx(tc,PDF);
but the code you've posted contains no variable called PDF. Instead you have,
semilogx(tc,File3)
where File3 is not even vector of numeric data. It's just a file name.

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by