purpose of state-space with pid
1 次查看(过去 30 天)
显示 更早的评论
azan
2012-10-11
Hi everyone! I am having problem that when I connect state space block to PID and take its output as feedback in simulink I get a plot that converges at reference value; now I have to do the same job in mfile I have done the coding for pid but I am not getting idea that; what is the purpose of state space connected with pid so that I can write code for it.
采纳的回答
Azzi Abdelmalek
2012-10-11
编辑:Azzi Abdelmalek
2012-10-11
clear,close
%your model and its input output
mot=tf(1,[1 1]),
model=ss(mot);
[F,h,c,d]=ssdata(model);
model.u='u'
model.y='y'
%your pid controller
r=pid(5,1/0.05,10)
r.u='e'
r.y='u'
%adding a reference r with som2=r-y
som1 = sumblk('e = r - y');
%global model with all conneection
modelg=connect(som1,r,model,'r','y')
%simulation
step(modelg)
27 个评论
azan
2012-10-11
Sir its giving error at model y='y' and the statement of error is 'Invalid property name y'
azan
2012-10-11
first code didn't work,however your code is running but I am not sure of the value P
azan
2012-10-11
And sir I have to give input from my sensor and compare it with my reference value.Sir I need to know where that input value will be in this code.
Azzi Abdelmalek
2012-10-11
why are 'nt you using simulink? how are you connecting your sensor to your computer and matlab?
azan
2012-10-11
Sorry sir I couldn't get this what do you mean by clicking model.u and model.y? Now the error is 'Invalid property name "y". Type "help ltiprops" for more information on valid LTI properties.'
Azzi Abdelmalek
2012-10-11
azan have you copied and past my code or what? because I see in your error message , model y (it's no my code) it's model.y (you missed a dote)
azan
2012-10-11
No it was just a typing mistake.I have written model.y Infact I have just copied your code
Azzi Abdelmalek
2012-10-11
I can't explain what is going on, because, whe I run my code it works fine
azan
2012-10-13
Sir code is working now and the issue was I had to write like this model.inputname='u' model.outputname='y'
azan
2012-10-13
Sir can you now tell me where is that input(e.g 6 taken from image processing part) in this code which I have to compare with the reference value
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!发生错误
由于页面发生更改,无法完成操作。请重新加载页面以查看其更新后的状态。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
亚太
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)