Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

Frequency response in MatLab question

Status
Not open for further replies.

T_M_S

Automotive
Dec 22, 2021
55
0
0
RU
I’m doing my very first steps in MatLab (5 days since I had a first look at it).
I’d like to ask for a bit of help:
A bit of pretext: I’m trying to learn about vehicle ride dynamics using Adams car/ride 4 post shaker rig. I created a model representing amg gt4 car and excite the car with chirp input (constant velocity sine sweep).
I intend to postprocess the results in MatLab. My aim is to be able to get frequency response functions (FRF) – in a way described in attached pdf file (p.8, 7 post rig data analysis)

So far I’m able to import data to MatLab (exporting as table/spreadsheet from A/car) and create plots of power spectrum, psd and transfer function.
In that attached pdf author is using mathlab TFE function to get FRF. I’m using TFESTIMATE (but I tried TFE as well). Problem is that his results (Y axis) look very different to what I get – I get results in Db and his results are in… who knows. It looks like ratio to me.
Heave_FRF_mnvezu.png

MyHeaveResponse_ojckm6.jpg

Is there a way that I can convert my Y axis from decibels to magnitude? There is a Matlab function db2mag but I can’t figure out how to apply it to my transfer function results.

Thank you,
Ted


 
Replies continue below

Recommended for you

In Newey's book he mentions it as being a problem with an early Leyton House car. Basically as the front tire flexed the front of the floor got too close the ground , blocking the flow, or stalling the airflow, so it lost downforce, the front came up, and then the whole cycle repeated itself. Hard to fix with a passive suspension because the main compliance is undamped.

Cheers

Greg Locock


New here? Try reading these, they might help FAQ731-376
 
OK, I'm back home and able to reply.
Many thanks for your help Cibachrome!
I already found answers to my initial questions - it was a matter of getting the units/scaling straight:

For a frequency response I was using (Live script):

Heave_ Chassis Acceleration Response Magnitude Ratio

[h_az_tf,n]=tfestimate(act_az,heave_az,winsize,overlap,nfft,Fs);
[h_az_tf2,n]=tfestimate(act_az2,heave_az2,winsize,overlap,nfft,Fs);
plot(n,abs(h_az_tf),'r')
xlim(l)
hold on
plot(n,abs(h_az_tf2),'b')
hold off
title("Heave Chassis Acceleration FRF Ratio")
xlabel('Frequency (Hz)')
ylabel('Magnitude')
legend('d1',"d2")

Heave_ Chassis Acceleration Response Phase

plot(n,angle(h_az_tf)*57.3,'r')
xlim(l)
ylim([-200 200])
hold on
plot(n,angle(h_az_tf2)*57.3,'b')
hold off
title("Heave Chassis Displacement FRF PHASE")
xlabel('Frequency (Hz)')
ylabel('Phase Angle')
legend('d1',"d2")

d1_HeaveAcc_FRF_Max=max(abs(h_az_tf))
d2_HeaveAcc_FRF_Max=max(abs(h_az_tf2))
d1_HeaveAcc_FRF_RMS=rms(abs(h_az_tf))
d2_HeaveAcc_FRF_RMS=rms(abs(h_az_tf2))


This was to compare two different damper settings.
I fugured out that I need to increse the simulation time to get better resolution at each frequency step - this seems to be inline with your suggestion from your latest post.

Now let me study your code a little. This is a bit above my current MatLab knowledge level (remember my MatLab experience is less than a month at this point).

Thank you,
Ted

PS: Attached is Acar simulation data files

 
 https://files.engineering.com/getfile.aspx?folder=8fd4e693-acf2-48b7-b089-e63c1f06df18&file=ShakerRigDataInput.mat
There is a Matlab Controls setup panel that is supposed to allow you to choose units and display schemes.

ctrlpref

But it doesn't seem to be working for me. Set the preferences and reload Matlab.

But, the danger is ruining all your previous codes ! (as it did mine !)
 
Thanks Cibachrome,
Thing is that requests in A/Car are predefined and it is a bit too complicated to redefine them atm. So I set the units/scaling manually as can be seen in DataImport.mlx that I uploaded.


Thank you,
Ted
 
So far I'm having problem with adopting your transfer function code to my current data (see above uploaded .mat file).
This portion:

% Now go get the transfer function:
options = optimset('MaxFunEvals',1000000,'TolFun',.0000001,'Display','on');
FM0=[ .1 1 0.15 0.23 ]
for n=1: 5
[FM,error] = lsqcurvefit('splane2_fit',FM0 ,freq ,heave_gain,[],[],options);
heavesys =tf([FM(1:2 )],[FM(3:4) 1 ])
FM0=FM+ .001*rand(1);
end

I added above code to this live script:

[h_az_tf,n]=tfestimate(act_az,heave_az,winsize,overlap,nfft,Fs);
[h_az_tf2,n]=tfestimate(act_az2,heave_az2,winsize,overlap,nfft,Fs);
plot(n,abs(h_az_tf),'r')
xlim(l)
hold on
plot(n,abs(h_az_tf2),'b')
hold off
title("Heave Chassis Acceleration FRF Ratio")
xlabel('Frequency (Hz)')
ylabel('Magnitude')
legend('d1',"d2")

plot(n,angle(h_az_tf)*57.3,'r')
xlim(l)
ylim([-200 200])
hold on
plot(n,angle(h_az_tf2)*57.3,'b')
hold off
title("Heave Chassis Displacement FRF PHASE")
xlabel('Frequency (Hz)')
ylabel('Phase Angle')
legend('d1',"d2")
heave_gain=abs(h_az_tf)

Here I add your code with changes apropriate for my code above

options = optimset('MaxFunEvals',1000000,'TolFun',.0000001,'Display','on');
FM0=[ .1 1 0.15 0.23 ]
for n=1: 5
[FM,error] = lsqcurvefit('splane2_fit',FM0 ,n ,abs(h_az_tf),[],[],options);
heavesys =tf([FM(1:2 )],[FM(3:4) 1 ])
FM0=FM+ .001*rand(1);
end

N_1=num2str(FM(1));
N_0=num2str(FM(2));
D_2=num2str(FM(3));
D_1=num2str(FM(4));
D_0= '1';

Problem that it gives me an error:
Error using lsqcurvefit (line 286)
Function value and YDATA sizes are not equal.

How do I get your function splane2_fit to be the same size as my YDATA (abs(h_az_tf)?

Thank you,
Ted

 
"Thing is that requests in A/Car are predefined and it is a bit too complicated to redefine them atm"

I nearly fell of my chair at that one. In order to make our custom scripts work with /Car, MSC (or some lucky contractor) have written a black box that takes Car req files and re-mangles them back into the form we used to have in Chassis, where REQ numbers were fixed, for example REQ/1080 was always toe caster camber. I am not aware of the gory details.

Cheers

Greg Locock


New here? Try reading these, they might help FAQ731-376
 
Status
Not open for further replies.
Back
Top