Frequency response signal - resonce frequency
4 views (last 30 days)
Show older comments
Hi all, i have the singal attached and i want to evaluate the frequency response, to get the resonce frequency
Thanks a lot in advance
0 Comments
Accepted Answer
LO
on 30 Mar 2021
Edited: LO
on 30 Mar 2021
Based on the info provided I came up with this, you basically have to use the pwelch function and set some sampling rate (which in your file I am not sure is indicated).
I have used the value 642 (assuming the second decimal unit of your time vector is a second, you have 642 samples per second, so the sampling frequency is 642 Hz). Change this value to the proper value if you know the sampling rate or simply calculate how many samples you have in a second (i.e. how many rows in your imported data array you have in between consecutive seconds).
you can select each column of the imported data to calculate the freq of each. edit the first line adding your path.
The first block is a MATLAB generated script simply to import your data. the last 3 lines are those which count.
%% Import data from text file.
%% Initialize variables.
filename = 'C:\[add here path to your file]\T0024ALL.CSV';
delimiter = ',';
startRow = 17;
%% Format for each line of text:
formatSpec = '%f%f%f%f%f%f%f%f%f%*s%*s%*s%[^\n\r]';
%% Open the text file.
fileID = fopen(filename,'r');
%% Read columns of data according to the format.
dataArray = textscan(fileID, formatSpec, 'Delimiter', delimiter, 'TextType', 'string', 'EmptyValue', NaN, 'HeaderLines' ,startRow-1, 'ReturnOnError', false, 'EndOfLine', '\r\n');
%% Close the text file.
fclose(fileID);
%% Create output variable
T0024ALL = table(dataArray{1:end-1}, 'VariableNames', {'Model','MSO2024','VarName3','VarName4','VarName5','VarName6','VarName7','VarName8','VarName9'});
%% Clear temporary variables
clearvars filename delimiter startRow formatSpec fileID dataArray ans;
signal = table2array(T0024ALL(:,1)); % change column number to select another signal
[p,f] = pwelch(signal,8192,4096,8192,642); % extract signal frequency, increae "nfft" and "window" in case of similar frequencies
idx = find(p==max(p(find(f<max(f) & f>min(f))))); % here indicate limits of freq if you want to limit the search within a given range
FREQ = f(idx); % this is the freq of your signal !
As an alternative you can use the signal processing toolbox
which makes it probably easier to go through your data, select signals and get their freq values
https://de.mathworks.com/products/signal.html
0 Comments
More Answers (0)
See Also
Categories
Find more on Get Started with Signal Processing Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!