From: Alex Thiele on
Dear all,

I have written and used the following code under MATLAB ver 7.3 without any problem but it does not work correctly under ver 7.10;

Numerator = ones(1,24);
Denominator = zeros(1,24);
Denominator(1,1) =24;
Averager_TF_z = tf([Numerator],[Denominator],1/6000);
bode(Averager_TF_z)

The code just generates the gain/phase responses for a simple 24 point averager.

The probelm is in the BODE function. The gain response returned from bode is correct, but the phase response is incorrect. The phase at 0Hz should be 0° and this is what ver 7.3 returned. Ver 7.10 however returns a phase of 4pi (720°) at 0Hz. The whole phase response is lifted.

I have tried searching for a change history of the bode function to see why it doesnt work anymore but cannot find it.

Any suggestions as to why bode doesn't work in this instance greatfully received. Many thanks,

Alex Thiele
From: Alec Stothert on

Try right click the bode reponse plot and select the "Properties..." menu
item. From the properties dialog select the options tab and under the phase
response check "Adjust phase offsets". Does this give the phase you exepect?

Note that 720 is a multiple of 360 so the phase isn't wrong just offset by a
couple of revolutions.

-Alec

"Alex Thiele" <bert1234(a)yahoo.com> wrote in message
news:hvn40o$2e8$1(a)fred.mathworks.com...
> Dear all,
>
> I have written and used the following code under MATLAB ver 7.3 without
> any problem but it does not work correctly under ver 7.10;
>
> Numerator = ones(1,24);
> Denominator = zeros(1,24);
> Denominator(1,1) =24;
> Averager_TF_z = tf([Numerator],[Denominator],1/6000); bode(Averager_TF_z)
>
> The code just generates the gain/phase responses for a simple 24 point
> averager.
>
> The probelm is in the BODE function. The gain response returned from bode
> is correct, but the phase response is incorrect. The phase at 0Hz should
> be 0� and this is what ver 7.3 returned. Ver 7.10 however returns a phase
> of 4pi (720�) at 0Hz. The whole phase response is lifted.
>
> I have tried searching for a change history of the bode function to see
> why it doesnt work anymore but cannot find it.
>
> Any suggestions as to why bode doesn't work in this instance greatfully
> received. Many thanks,
>
> Alex Thiele


From: Alex Thiele on
Hi alec, thank you very much for your reply.

Yes, checking 'adjust phase offsets' does then give the correct phase repsonse. It there any way I can automate this option?

I tried;

p=bodeoptions;
p.PhaseMatching='on';

but this didn't work. The problem is that this needs to be automated in the software I am creating. (actually it's an exe I created in ver 7.3 that people use. But I'm now updating the exe in ver 7.10 but cannot compile it until I get the bode function working again)

Regards,
From: Alec Stothert on
Hi Alex,

You need to pass the bodeoptions to the bode command, the follwoing worked
for me:

>> opt = bodeoptions;
>> opt.PhaseMatching = 'on';
>> bode(Averager_TF_z,opt)

-Alec

-Alec
"Alex Thiele" <bert1234(a)yahoo.com> wrote in message
news:hvnk2h$kl3$1(a)fred.mathworks.com...
> Hi alec, thank you very much for your reply.
>
> Yes, checking 'adjust phase offsets' does then give the correct phase
> repsonse. It there any way I can automate this option?
>
> I tried;
>
> p=bodeoptions;
> p.PhaseMatching='on';
>
> but this didn't work. The problem is that this needs to be automated in
> the software I am creating. (actually it's an exe I created in ver 7.3
> that people use. But I'm now updating the exe in ver 7.10 but cannot
> compile it until I get the bode function working again)
>
> Regards,


From: Alex Thiele on
Hi Alec,

Thank you very much for your help - problem solved.

Best regards,

Alex