フィルターのクリア

Why do I receive an error when I run this code?

2 ビュー (過去 30 日間)
sadel
sadel 2011 年 6 月 9 日
Why do I receive an error when I run this code?
sys=tf([1],[1 1],'InputDelay',2)
sysd=c2d(sys,0.5)
[num,den]=tfdata(sysd)
num=num2str(num{:})
den=num2str(den{:})
num=poly2sym(num,z)
den=poly2sym(den,z)
num=char(num)
den=char(den)

採用された回答

Paulo Silva
Paulo Silva 2011 年 6 月 9 日
Bad use of the poly2sym function, you give a string for the first argument but the function expects one array.
Also the z should be like this 'z'
doc poly2sym
Just a tip: num{:} gives you one array, that array can be used by poly2sym
sys=tf([1],[1 1],'InputDelay',2)
sysd=c2d(sys,0.5)
[num,den]=tfdata(sysd)
num=vpa(poly2sym(num{:},'z'),4)
den=vpa(poly2sym(den{:},'z'),4)
nums=char(num)
dens=char(den)
There were some errors, I had to edit the answer several times but I think that now it's all working.
  5 件のコメント
Paulo Silva
Paulo Silva 2011 年 6 月 9 日
ok I fixed the code again, no more big and precise values, happy now?
sadel
sadel 2011 年 6 月 9 日
hahaha yes, thank you very much!!!!

サインインしてコメントする。

その他の回答 (1 件)

Julián Francisco
Julián Francisco 2011 年 6 月 9 日
My Matlab program says that you have not defined the variable z.
  1 件のコメント
Paulo Silva
Paulo Silva 2011 年 6 月 9 日
it should be like this 'z' instead of just z

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

タグ

タグが未入力です。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by