How to Make a Bode Plot from Multiple Text Files

조회 수: 14 (최근 30일)
Charles Hump III
Charles Hump III 2020년 11월 6일
댓글: madhan ravi 2020년 11월 6일
I need help making a bode plot from 19 text files that each have 3000 rows and 3 columns. For the columns, column 1 = time, column 2 = input, and column 3 = response from system. Each file has a given frequency, which is stated in the file name. I was able to create a plot for each file with the x & y axes, x being time and y being amplitude. I do not know how to create a single bode plot from all the data. I cannot create a transfer function from the data and make a bode plot from that. I have to make the bode plot first and then the transfer function.
I have attached an image of my code below.
Please write down the code on how to do this because I’m only a beginner when it comes to Matlab.
Thank you
  댓글 수: 3
Ugly Hump
Ugly Hump 2020년 11월 6일
편집: madhan ravi 2020년 11월 6일
files = dir('*.txt');
for f = 1:length(files)
data = dlmread(files(f).name);
plot(data(:,1),data(:,2),'r') % plots input
hold on
plot(data(:,1),data(:,3),'b') % plots response
grid on
xlabel('time (seconds)')
ylabel('amplitude')
title(replace( replace(files(f).name,'_','.') ,'.txt',' rad/sec'))
pause
hold off
end
madhan ravi
madhan ravi 2020년 11월 6일
Was there a reason to create so many profiles just to ask the same question?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Frequency-Domain Analysis에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by