# Extract signal values from a data file

조회 수: 3(최근 30일)
Hussein Kokash 2022년 12월 19일
댓글: Star Strider 2022년 12월 23일
Hello all,
I am trying to extract some basic signal values from a data file that I have which is a plot of a sinosodial wave vs length:
z = data(:,1);
y = data(:,2);
figure(1)
plot(z,y,'b')
xlabel('Spanwise length')
ylabel('Velocity')
I want to identify and match the following:
% Fs=800;
% Tf=2;
% t=0:1/Fs:Tf;
% f=[40 75];
% Amp=[4.5 9.22];
% sigma=1.33;
% y=Amp(1)*exp(j*2*pi*t*f(1))+Amp(2)*exp(j*2*pi*t*f(2));
% N=(sigma/sqrt(2))*(randn(size(t))+j*randn(size(t)));
% y=y+N;
% fy=FFT(y,Fs);
The above code is part of the code:
PSD (Power Spectral Density), and Amplitude Spectrum with adjusted FFT
I know that the length in my case is z, Can you guide me on how to identify the above values (Fs, Tf, f, Amp, N, etc..)?
The data file is attacehd, I appreciate your input.
Thanks!

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

### 채택된 답변

Star Strider 2022년 12월 19일
I am not certain what ‘identify and match’ means. It is certainly possible to filter the 40 and 75 Hz frequencies individually, and their both defining a bandwidth, with a bandpass filter (introduced in R2018a, so you should have it) —
z = data(:,1);
y = data(:,2);
Fs = 1/mean(diff(z))
Fs = 500
f=[40 75];
figure(1)
plot(z,y,'b')
xlabel('Spanwise length')
ylabel('Velocity')
Hz40 = bandpass(y, [-1 1]+f(1), Fs, 'ImpulseResponse','iir');
Hz75 = bandpass(y, [-1 1]+f(2), Fs, 'ImpulseResponse','iir');
Hz4075 = bandpass(y, f, Fs, 'ImpulseResponse','iir');
figure
subplot(3,1,1)
plot(z, Hz40)
grid
ylabel('Amplitude')
title('40 Hz')
subplot(3,1,2)
plot(z, Hz75)
grid
ylabel('Amplitude')
title('75 Hz')
subplot(3,1,3)
plot(z, Hz4075)
grid
xlabel('z')
ylabel('Amplitude')
title('40-75 Hz')
Experiment to get different results.
.
##### 댓글 수: 6표시 이전 댓글 수: 5숨기기 이전 댓글 수: 5
Star Strider 2022년 12월 23일
As always, my pleasure!
The ability to use table variables that were not valid MATLAB variable names was introduced after R2018b. I forgot about that. Use: 'PSDs_dB' and such instead (or create your own variable names, since there is nothing particularly sacred about the ones I chose). Anything that is a valid MATLAB variable name should work.
PSDdBTable = table(freqs,pow2db(PSDs),pow2db(PSDci),'VariableNames',{'freqs','PSDs_dB','PSDci_dB'})
That should run without error.
.

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

### 범주

Find more on Spectral Measurements in Help Center and File Exchange

R2018b

### Community Treasure Hunt

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

Start Hunting!

Translated by