Using etfe and spa commands - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Using etfe and spa commands

idwtyidwty Posts: 1Member
I believe the general form of these commands are as follows:
etfe
g=etfe(dat,[],fv);

spa
h=spa(dat,[],linspace(0,3.1416,fv));

where dat is the matrix that contains the input and output data
where fv is some final value of the number of frequency partition (I think)
where g and h is just some dummy variable
where linspace means it'll be using linear rather than logarithm
where [] denotes the default

I believe fv means how many points you want for the frequency response Bode plot (e.g. resolution). But when I tried it out I found out well its not exactly like that.

I did several tests, using a fv = 400:1:410, I found out that even though a change of 1 value the Bode plot changes drastically. And this is NOT a resolution change (e.g. the amount of details).

Another test that I did was using a fv = 500:500:2000, I found that it actually have a resolution change. The general form of the Bode plot is the same except more detailed peaks; specifically peaking lower and lower near the last point. For example, say fv = 500 had the last and lowest point at -2000. Then fv = 2000 would have had something like -6000.

I really do not know why this is happening or how to choose the "correct" fv value. I tried using ident (system identification tool) to find what I should be expecting but that did not help much.

The following is the code for the script (m-file) I used.
t1rm = temperature1 with mean removed (output)
s1rm = steam value position1 with mean removed (input)

dat=iddata(t1rm,s1rm,1);
fv=500;
g=etfe(dat,[],fv);
fr=get(g,'frequency');
frs=get(g,'responsedata');
figure
subplot(211)

for i=1:fv-1
loglog([fr(i),fr(i+1)],[abs(frs(1,1,i)),abs(frs(1,1,i+1))])
hold on
end

for i=1:fv-1
ph(i)=phase(frs(1,1,i));
end

ylabel('Amplitude')
title('Frequency Response (Zero-Mean)')
phun=unwrap(ph);
subplot(212)

for i=1:fv-1
semilogx([fr(i),fr(i+1)],[phun(i)*180/pi,phun(i+1)*180/pi])
hold on
end

xlabel('Frequency (Rads/s)')
ylabel('Phase (Deg)')

Sign In or Register to comment.