简体   繁体   English

“ num”和“ den”属性的值必须是行向量或行向量的单元格数组,其中每个向量均为非空

[英]The values of the “num” and “den” properties must be row vectors or cell arrays of row vectors, where each vector is nonempty

I am quite new to Matlab . 我对Matlab陌生 I want to plot for the following equation in Matlab . 我想在Matlab中绘制以下方程式。

G(s)= 1* (e-0.5s) /(s+1) (s+5)^2

When, I type in Matlab like this, 当我这样输入Matlab时

clear all

clc

syms s

Gnum=exp(-0.5*s);

Gden=((s+1)*((s+5)^2));

G= tf (Gnum,Gden)

H=1

T= feedback (G,H)

step(T)

But I encountered error as per below. 但是我遇到如下错误。

??? Error using ==> tf.tf at 239

The values of the " num " and " den " properties must be row vectors or cell arrays of row vectors, where each vector is nonempty and containing numeric data. num ”和“ den ”属性的值必须是行向量或行向量的单元格数组,其中每个向量都是非空的并且包含数字数据。 Type " ltiprops tf " for more information. 键入“ ltiprops tf ”以获取更多信息。

Error in ==> Untitled4 at 7

G= tf (Gnum,Gden)

Please help. 请帮忙。 Thanks in advance. 提前致谢。

You are mixing things very badly. 您的混音非常糟糕。 You can't make s syms and then make transfer function using it. 你不能让s SYMS,然后用它做出的传递函数。 Also, you do not plot a transfer function. 同样,您不plot传递函数。 You should use Bode on it to show the frequency and the magnitude of the transfer function for that. 您应该在其上使用Bode来显示传递函数的频率和幅度。 Just forget about syms all together when using Matlab control systems. 使用Matlab控制系统时,只需一起忘记符号。

s=tf('s');
sys=exp(-0.5*s)/((s+1)*(s+5)^2)    
sys =     
                           1
  exp(-0.5*s) * ------------------------
                s^3 + 11 s^2 + 35 s + 25

Continuous-time transfer function.

sysf= feedback (sys,1);
step(sysf)

Mathematica图形

If all you are wanting to do is plot that function, then something along the lines of this should suffice: 如果您只想绘制该函数,则符合以下要求的内容就足够了:

s = -10:.5:10;

G = 1 .* (exp(1)-0.5.*s) ./ (s+1) .* (s+5).^2;

plot(s,G)

绘图图

You can use ezplot too if you want to plot G(s) where: 如果要在以下位置绘制G(s) ,也可以使用ezplot

G(s)=exp(-0.5*s)/((s+1)*((s+5)^2));

You can use ezplot as follows: 您可以按以下方式使用ezplot

ezplot('exp(-0.5*s)/((s+1)*((s+5)^2))');

to generate the following image: 生成以下图像:

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM