2

I have a plant equation.Say,

Plant = tf([0 1] ,[1 1],'InputDelay',1);
t = 1:1:100;

Now I have a input value a= 0.0552 ,at the time instance t=1.I want to calculate output of the plant at t=1(which should be a numeric value as well!) How to do that!

If I give input a(1)=0.5552 at t=1 then y (output) is calculated based upon only a(1).

Similarly at t=2 my input is a(2)=0.4481(say)....

at t=3 ,a(3)=0.4100 ...So on.Then how would i be able to get the proper y(t1,a1),y(t2,a2)...values .

C8H10N4O2
  • 18,312
  • 8
  • 98
  • 134
Sarit Hati
  • 31
  • 3
  • Use Simulink, it will take care of it for you – percusse Nov 21 '16 at 10:37
  • @percusse this can be done in MATLAB – Ander Biguri Nov 21 '16 at 10:59
  • Weird question: If your input starts at `t=1`, then the output at `t=1` is very easy to know, `0`. You did not give the system time to react. Why do you want to know the output at `t=1`? – Ander Biguri Nov 21 '16 at 11:00
  • @AnderBiguri Yes but simulink is the reason not to do these by hand. – percusse Nov 21 '16 at 11:08
  • @percusse Look at my answer. It takes *more* effort to do this system in simulink than adding 3 lines of code to what he has. Doing things in MATLAB is **not** doing them by hand – Ander Biguri Nov 21 '16 at 11:10
  • @AnderBiguri I know how to use it pretty OK. I'm talking about people who are new to simulation should be better off using simulink instead of finding about StepOptions structs which are pretty new and not accessible to many people using university's/company's old matlab – percusse Nov 21 '16 at 11:13
  • @percusse I like Simulink. I still disagree. Also, `StepOptions` were introduced almost 5 years ago. – Ander Biguri Nov 21 '16 at 11:13

2 Answers2

0

You basically have a step input of value 0.0552. You can easily use the function step for this as:

Plant = tf([0 1] ,[1 1],'InputDelay',1);
t = 1:1:100;
opt = stepDataOptions;
opt.StepAmplitude = 0.0552;  
step(Plant, t, opt);

That will create the following plot:

enter image description here

If you want not to plot, but to get the response, just catch step's output:

y=step(Plant, t, opt);
Ander Biguri
  • 35,140
  • 11
  • 74
  • 120
  • But ,what i actually need to do, is to get the instntaneous value out of this plant eqn. May be I was not clear (due to insufficient knwledge :P) Actually, I've designd a Fuzzy Cntroller(Manually without using toolbox) which gives output at each iteration until 'the plant' reaches some set-point value.I need to get the full respnse that is, Suppse,Iteration 1 > a=0.5558>then TF >O/P value(numeric not matrix) iteration 2 >a(calculated base upon 'O/P value')>TF>output value(numeric not matrix) ...store all O/P value genrated at each iteration.Then plot O/P vs time(or iteration)! – Sarit Hati Nov 22 '16 at 06:36
  • The instantaeous value at any `t0`, e.g. `t0=1` is `y(t0)` – Ander Biguri Nov 22 '16 at 08:16
  • yes that is it ... but if I give input a(1)=0.5558 at t=1 then y is calculated based upon only a(1).But,at t=2 my input is a(2)=0.4481(say)....at t=3 ,a(3)=0.4100 ...So on.Then how would i be able to get the proper y(t1,a1),y(t2,a2)...values .Hope I am clear! :'( – Sarit Hati Nov 23 '16 at 06:39
  • @SaritHati then the description of you problem is wrong. Please, try to add all the information in the question – Ander Biguri Nov 23 '16 at 11:56
  • I am Sorry @Ander !! – Sarit Hati Nov 24 '16 at 04:59
0

I find this after long search..Instead of using the equation in laplace form.We have to use the differential form the with the help of runge -kutta method it can be solved.( that is to get the output in numeric approximated terms)

Sarit Hati
  • 31
  • 3