Extract signal values from a data file
7 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hussein Kokash
il 19 Dic 2022
Commentato: Star Strider
il 23 Dic 2022
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:
data = dlmread('data_30.txt');
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!
0 Commenti
Risposta accettata
Star Strider
il 19 Dic 2022
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) —
data = readmatrix('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1236212/data_30.txt');
z = data(:,1);
y = data(:,2);
Fs = 1/mean(diff(z))
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 Commenti
Star Strider
il 23 Dic 2022
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.
Try this instead —
PSDdBTable = table(freqs,pow2db(PSDs),pow2db(PSDci),'VariableNames',{'freqs','PSDs_dB','PSDci_dB'})
That should run without error.
.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Parametric Spectral Estimation in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!