[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Control System Design methods using Octave.
From: |
shall689 |
Subject: |
Re: Control System Design methods using Octave. |
Date: |
Thu, 7 Dec 2017 14:07:42 -0700 (MST) |
Doug Stewart-4 wrote
> On Thu, Dec 7, 2017 at 10:30 AM, shall689 <
> sahallacy@
> > wrote:
>
>> Doug Stewart-4 wrote
>> > On Wed, Dec 6, 2017 at 4:57 PM, shall689 <
>>
>> > sahallacy@
>>
>> > > wrote:
>> >
>> >> Ok, I removed SampleFrequency from the tf function, i.e. tf(b,a)
>> instead
>> >> of
>> >> tf(b,a,SampleFrequency).
>> >>
>> >> The bode plot seem to match each other much better and the frequency
>> >> range
>> >> is a little better, with the only issue is that the max discrete
>> >> frequency
>> >> is 10 (>> pi).
>> >>
>> >> Is there some type of issue with the bode() function?
>> >>
>> >>
>> >> <http://octave.1599824.n4.nabble.com/file/t372348/BodePlot2.png>
>> >>
>> >>
>> >>
>> >> --
>> >> Sent from: http://octave.1599824.n4.nabble.com/Octave-General-
>> >> f1599825.html
>> >>
>> >>
>> > Hi Shall
>> > If you would post your exact code, for me to run, then I am sure that I
>> > can
>> > answer your questions.
>> > https://pastebin.com/ is one way to post it.
>> >
>> >
>> >
>> > --
>> > DAS
>> >
>> > <https://linuxcounter.net/user/206392.html>
>> >
>> > _______________________________________________
>> > Help-octave mailing list
>>
>> > Help-octave@
>>
>> > https://lists.gnu.org/mailman/listinfo/help-octave
>>
>>
>> The a and b were reversed in the tf() function. I corrected that issue
>> (see
>> below). Now, there is even a greater difference between the simulator's
>> frequency response data and the transfer function returned by invfreqz().
>>
>> Stephen
>>
>>
>> pkg load control;
>> pkg load signal;
>> clear all
>> close all
>> clc
>> x = csvread('buckVfreqResp.csv');
>> SampleFrequency = 20000;
>> f = x(:,1);
>> r = x(:,2);
>> phase_rad = x(:,3).*(pi/180);
>> h = r.*cos(phase_rad) + r.*(sin(phase_rad)*i);
>> w = f.*2*pi/SampleFrequency;
>> [b,a] = invfreqz(h,w,2,2)
>> sys = tf(a,b,1/SampleFrequency)
>> bode(sys);
>>
>>
>>
>> --
>> Sent from: http://octave.1599824.n4.nabble.com/Octave-General-
>> f1599825.html
>>
>> _______________________________________________
>> Help-octave mailing list
>>
> Help-octave@
>> https://lists.gnu.org/mailman/listinfo/help-octave
>>
> Sorry for the long delays.
>
> I think this is much closer to what you want.
> But it is giving me complex roots and they should be closer to 2 real
> roots.
>
> clear
>
> pkg load control;
> pkg load signal;
> clear all
> x = csvread('buckVfreqResp.csv');
> SampleFrequency = 20000;
> T = 1/SampleFrequency;
> f = x(2:end,1);
> r = x(2:end,2);
> ph=x(2:end,3);
> figure(1)
> semilogx(f,r,f,ph)
> grid minor on
> # this shows that you have a total of 180 deg phase shift
> # and 90 deg is at about 515 Hrz
> # so you have a second order system with a corner freq of 515 Hz.
>
> phase_rad = ph.*(pi/180);
> w=2*pi*f;
> # now plot it with radians if you want to.
> figure(2)
> semilogx(w,r,w,phase_rad)
> grid minor on
>
> r1=10.^(r./20);
> figure(3)
> h = r1.*cos(ph) + r1.*(sin(ph)*i);
> w = f.*(2*pi*T);
>
>
> [b,a] = invfreqz(h,w,0,2)
> sys = tf(b,a,T)
> bode(sys)
>
>
>
> --
> DAS[image: Certificate for 206392]
>
> <https://linuxcounter.net/user/206392.html>
>
> _______________________________________________
> Help-octave mailing list
> Help-octave@
> https://lists.gnu.org/mailman/listinfo/help-octave
Hello Doug,
That's closer. I think I was getting confused with rad and rad/sec. I was
thinking that the x axis was rad.
Is there a way to get the final transfer function to more closely match the
cutoff frequency and low frequency gain?
Thanks,
Stephen
--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html
- Re: Control System Design methods using Octave., (continued)
- Re: Control System Design methods using Octave., shall689, 2017/12/06
- Re: Control System Design methods using Octave., Doug Stewart, 2017/12/06
- Re: Control System Design methods using Octave., shall689, 2017/12/06
- Re: Control System Design methods using Octave., shall689, 2017/12/06
- Re: Control System Design methods using Octave., Doug Stewart, 2017/12/06
- Re: Control System Design methods using Octave., shall689, 2017/12/07
- Re: Control System Design methods using Octave., shall689, 2017/12/06
- Re: Control System Design methods using Octave., shall689, 2017/12/06
- Re: Control System Design methods using Octave., shall689, 2017/12/07
- Re: Control System Design methods using Octave., Doug Stewart, 2017/12/07
- Re: Control System Design methods using Octave.,
shall689 <=