Question

Thank you so much.

0O A classic second order system has transfer function G(s) where the symbols have their usual meanings. Take the undamped nad) Write down the difference equation obtained from MATLAB for Ç-0.5 e) Take your difference equation from d) and write a com

0O A classic second order system has transfer function G(s) where the symbols have their usual meanings. Take the undamped natural frequency to be 10 rad/s throughout this exercise. Note, for the following MATLAB simulations you need to use format long defined at the top of the program to get full precision
d) Write down the difference equation obtained from MATLAB for Ç-0.5 e) Take your difference equation from d) and write a computer program in Matlab to simulate a unit step response. (that is, for an input of unity, compute the output of the difference equation). Show the code and plot the result. Do not use a ready-made function such as step0, write the code from scratch using similar methods to the pseudo code method used in class. Run your program to 2.5 seconds. Show your code.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

d)MATLAB:

format long;
wn=10;d=0.5;
num=[wn^2]
den=[1 2*d*wn wn^2]
g2s=tf(num,den)

%Analog to digital Ttansfer function
fs=100
T=2.5;
ts=1/fs
[b,a]=bilinear(num,den,fs)
g2z=tf(b,a,ts)

Command window:

>> g2s

Transfer function 'g2s' from input 'u1' to output ...

100
y1: ----------------
s^2 + 10 s + 100

Continuous-time model.
>> g2z

Transfer function 'g2z' from input 'u1' to output ...

0.998 z^2 + 1.996 z + 0.998
y1: ---------------------------
z^2 + 1.996 z + 0.996

Sampling time: 0.01 s
Discrete-time model.

2. d. 0.99 z2 969 2 X(2) O.99 2.

e)


clc;close all;clear all;
format long;
wn=10;d=0.5;
num=[wn^2]
den=[1 2*d*wn wn^2]
g2s=tf(num,den)

%Analog to digital Ttansfer function
fs=100
T=2.5;
ts=1/fs
[b,a]=bilinear(num,den,fs)
g2z=tf(b,a,ts)

n=0:1:T/ts
%Impulse response
x=(n==0)
h=filter(b,a,x)

%step response
x1=(n>=0)
y=conv(h,x1)
m=0:1:2*T/ts
stem(m,y)
xlabel('n')
ylabel('y(n)')
title('Step response')

Step response 1.4 1.2 0.8 S 0.6 0.4 0.2 500 400 -0.2 300 200 100

Add a comment
Know the answer?
Add Answer to:
Thank you so much. 0O A classic second order system has transfer function G(s) where the symbols have their usual meanings. Take the undamped natural frequency to be 10 rad/s throughout this exercise...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT