Question

In: Electrical Engineering

How to generate spectral plots in MatLab of transfer function hw = (0.15*s^3+937500*s)/(0.15*s^3+375*s^2+1062500*s+2500000000) over the range...

How to generate spectral plots in MatLab of transfer function

hw = (0.15*s^3+937500*s)/(0.15*s^3+375*s^2+1062500*s+2500000000)

over the range from 100 Hz to 10 kHz, using 200 points per decade.

Solutions

Expert Solution

You can use the logspace command for this purpose.

For example, logspace(a,b,n) will generate n points which are logarithmically equally spaced between decades 10^a rad/s and 10^b rad/s.

If you want to store that in a vector say, y, then you will have to write y=logspace(a,b,n)

Now, for your given question, 100 Hz corresponds to 628 rad/s. 628 rad/s=10^2.8 rad/s. So, here a=2.8

10 kHz corresponds to 62800 rad/s. 62800 rad/s=10^4.8 rad/s. So here b=4.8.

Again, since your requirement is 200 points per decade and there are 2 decades between 100 Hz and 10 kHz, so n=2*200=400. Let the given system is G1. The matlab code is wriiten below.

Matlab code:

s=tf('s'); %% declare s for laplace domain

G1=(0.15*s^3+937500*s)/(0.15*s^3+375*s^2+1062500*s+2500000000); %%G1 as a transfer function

y=logspace(2.8,4.8,400); %%stores the data of 200 points per decade in vector y between 100 Hz and 10 kHz

[mag,phase,y]=bode(G1,y); %%calculates the spectral data (magnitude and phase of G1) at the points in vector y and stores the magnitude data in 'mag' and phase data in 'phase'  

Run the code. You will see three vectors y, mag and phase at your workspace. You will get the required data at the required points there

Further in the command window, type

bode_points=[ y, 20*log10 (mag(:,:)'), phase(:,:)' ] %% this will create a 400 x 3 vector with first column as the frequency points y, second column as the magnitude in dB and the third column gives phase in degrees at 400 points, 200 points per decade.

Create a new worspace variable Var1 and copy the frequency data in Var1, create Var2 and copy the magnitude data in Var2, create Var3 and copy the phase data in Var3. Now to get magnitude and phase plots, write in command window:

plot(Var1, Var2); %% gives magnitude plots, do not forget to convert the x-axis to log scale in place of linear

plot(Var1,Var3); %% gives phase plots, do not forget to convert the x-axis to log scale in place of linear.

You will get the required plots


Related Solutions

given the transfer function G(s) = (1.151 s + 0.1774)/(s^3 + 0.739 s^2 + 0.921 s),...
given the transfer function G(s) = (1.151 s + 0.1774)/(s^3 + 0.739 s^2 + 0.921 s), write the state equations x'= Ax + Bu + Dw , and y = Cx for the system .
A system has the transfer function H(s)=3(s2+7 s)/(s2+8s+4). Draw a Bode plot of the transfer function...
A system has the transfer function H(s)=3(s2+7 s)/(s2+8s+4). Draw a Bode plot of the transfer function and classify it as lowpass, highpass, bandpass, or bandstop. Draw the Direct Form II for this system.
Say we have a transfer function that is H(s)= (2s^2-5s+3) / (s-1). Which of these statements...
Say we have a transfer function that is H(s)= (2s^2-5s+3) / (s-1). Which of these statements is correct? This system is stable, since one of its zeros is in the right-hand part of the s-plane This system is stable, since one of its poles is in the right-hand part of the s-plane This system is unstable, since its only zero is in the left-hand part of the s-plane This system is stable, since its only pole is in the left-hand...
1. Determine the ROC for stability for transfer function H(s) = 1 / (s-2) ( s-1)...
1. Determine the ROC for stability for transfer function H(s) = 1 / (s-2) ( s-1) 2. Determine the ROC for stability for transfer function H(z) = (z-1) / (z+0.1) (z-0.2)
For the system with transfer function H(s)=1/(s-2)(s-1) determine the ROC for stability.
For the system with transfer function H(s)=1/(s-2)(s-1) determine the ROC for stability.
H(s)G(s) = 30(s+2)/(s^3+7s^2+12s) In MATLAB, Use the function margin to plot log-magnitude, phase, gain margin, phase...
H(s)G(s) = 30(s+2)/(s^3+7s^2+12s) In MATLAB, Use the function margin to plot log-magnitude, phase, gain margin, phase margin. Do not use the function bode. I graphed it using margin, but how do I just get the phase? I got the gain margin, phase margin, and the cross over frequencies. Thanks
Given a system with the transfer function p(S)= (s+1)/(s(2s^2+4s+3)(2s+1)) Each section must specify the way of...
Given a system with the transfer function p(S)= (s+1)/(s(2s^2+4s+3)(2s+1)) Each section must specify the way of solution / explanation / reasoning A. 8 points (Is the system in an open circle asymptomatic or BIBO stable or unstable? B. (8 pts) Closes a control circle with a proportional controller. What is the range of K values for which The closed circle is stable? third. 4 points (what is the constant state error of the system in the open circle for step...
Consider the transfer function G(s) = 1/[(s+1)^2(s+2)]. We use a PI compensator C(s)=(as+b)/s and close the...
Consider the transfer function G(s) = 1/[(s+1)^2(s+2)]. We use a PI compensator C(s)=(as+b)/s and close the feedback loop. 1.) Find out the entire range of a and b at which the closed-loop is stable and show it on the plane with a and b axes. 2.) At the border of instability, find the frequency of oscillations in terms of a. 3.) For what value of a, do we get the largest range of b for stability? What is this largest...
for the unity feedback system, the open loop transfer functions is G(s)=K(s+2)(s+3) / (((s^2)+2*s+2)(s+4)(s+5)(s+6)) a. sketch...
for the unity feedback system, the open loop transfer functions is G(s)=K(s+2)(s+3) / (((s^2)+2*s+2)(s+4)(s+5)(s+6)) a. sketch the root locus (detail step wise) b. find the jw-axis crossing and the gain. K, at the crossing
Some process has the following transfer function: Gp(s)= (s+8)/[(s+3)(s+6)(s+10)] We need to conrol this process very...
Some process has the following transfer function: Gp(s)= (s+8)/[(s+3)(s+6)(s+10)] We need to conrol this process very accurately so we add negative feedback and a controller. Design a suitable controller to meet the following specifications: Maximusm Overshoot is approximately 20% Settling time is 0.8s or smaller Steady-State error for a step input is zero
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT