英文:
Plotting response r(t) from R(s)
问题
对于系统函数 H(s)=s^2/(s^2+4) 和输入 E(s)=1/s^2。响应已计算为 R(s)=1/(s^2+4)。如何在时域绘制这个图形?
我尝试使用 lsim,但对我来说没有太多意义。我还尝试使用 step(),但我认为这是在输入是阶跃函数时使用的。
英文:
For system function H(s)=s^2/(s^2+4) and the input E(s)=1/s^2. The response was calculated to be R(s)=1/(s^2+4). How can I plot this in time domain?
I tried using lsim which didn't really make sense to me. I also tried using step() but I thought this is used when the input in a step function
答案1
得分: 1
以下是MATLAB代码的翻译:
使用以下MATLAB代码将为您提供系统的响应:
clear all; close all; clc; clf;
sys = tf([1 0 0],[1 0 4]);
t = 0:0.01:10;
u = t;
lsim(sys,u,t) % u,t define the input signal
您的输入是E(s)=1/s^2
,其拉普拉斯反演等于t
。这就是为什么在上面的代码中,我们有u = t
。
以下是响应的绘图:
灰线是输入,即t
。蓝色正弦线是系统的响应。它与您的响应兼容。响应是R(s)=1/(s^2+4)
,其拉普拉斯反演是0.5*sin(2*t)
,正如您在上面的图中看到的响应一样。
英文:
Using below MATLAB code will give you the response of system:
clear all; close all; clc; clf;
sys = tf([1 0 0],[1 0 4]);
t = 0:0.01:10;
u = t;
lsim(sys,u,t) % u,t define the input signal
Your input is E(s)=1/s^2
and its Laplace Inverse is equal to t
. That's why in above code, we have u = t
.
Below is the plot of response:
gray line is input which is t
. The blue sinusoidal line is the response of system. It is compatible with your response. The response is R(s)=1/(s^2+4)
and its Laplace Inverse is 0.5*sin(2*t)
, as you see in above plot as response.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论