Items tagged with dynamicsystems dynamicsystems Tagged Items Feed

This is a typical problem of what I find when learning DynamicSystems. Basically, I create number of systems by changing one paramter (the damping ratio in this case) and want to plot the unit step of all of them on the same plot to compare the effect of the damping ratio.

I setup the TransferFunction, used Simulate to obtain the response of each to the same input. The problem comes when I want to plot the respones.  I have to use plot[odeplot] it seems. But this only like to take one response at a time.

I can't use plot() since I do not have the actual function of the response in time. Unless I try to extract the differential equation from the sytem object, solve that and get a solution then use plot(). But if I do all of this, what do I need DynamicSystems in first place? 

I will show what I tried. I am sure there is some way to do this in Maple I just do not know yet the correct function or setup.

restart;
alias(DS=DynamicSystems);
H:=(w,zeta)->w^2/(s^2+2*zeta*w*s+w^2);
sys:= (w,zeta)->DS:-TransferFunction(H(w,zeta)):
sol:=seq(DS:-Simulate(sys(1,zeta),Heaviside(t)),zeta=0.1..1.2,.2):

Now I want to plot all the solutions in sol. I wanted to use plot(...) only to be able to obtain the automatic coloring of each solution.

If I try to use plots[odeplot], it works, but only on one at a time:

plots[odeplot](sol[1],t=0..10);

If I try this, it fails:

plots[odeplot]([sol],t=0..10);

I can get each plot separatly and then use display() but then lose the automatic coloring of the lines:

plots:-display(seq(plots[odeplot](sol[i],t=0..10),i=1..nops([sol])));

I am looking for the above plot, but have the lines each colors differently. I also need to figure how to add legend later. But one step at a time. I can't hard code the color in the plots[odeplot] call itself, since I do not know what color to give each line. plot([....],t=0..) allready does this automatically. But I can't use it!

Just to give an idea of the kind of plot I am trying to obtain, here it is in Mathematica:

sys = TransferFunctionModel[w^2/(s^2 + 2 z*w*s + w^2), s];
zValues = Range[.2, 1.2, .2];
fun = OutputResponse[sys /. {w -> 1, z -> #}, UnitStep[t], {t, 0, 12}] & /@ zValues;
Plot[Evaluate@Flatten@Table[fun[[i]], {i, 1, Length[fun]}], {t, 0, 12}, Frame -> True, PlotRange -> {{0, 12}, {-.1, 1.7}}]

 

 

 

When I do

restart:
alias(DS=DynamicSystems):
sys:=DS:-TransferFunction(5*s/(s^2+4*s+25)):
DS:-BodePlot(sys,output=dualaxis);

I get nice small plot.  with no outer frame filling the whole window



But if I just do

DS:-BodePlot(sys);

The plot is too large. So I tried the size option, but all what this did is reduce the plot size, but left the outer frame filling the whole window:

DS:-BodePlot(sys,size=[400,300]);

 

Is there a way to get the above plot, but either without the outer frame, or have the outerframe fit correctly around the plots?

Maple 18 on window 7

 

Here is one example:

restart;
alias(DS=DynamicSystems):
zeros :=[-1,-2]:
poles :=[0,-4,-6]:
gain  :=5:
sys   :=DS:-TransferFunction(zeros,poles,gain):

now sys above is a transfer function "object". But how would one go about extracting its properties? For example, I'd like to read the actual rational polynomial in s that represents the transfer function, which is embedded inside this oject, but I am not able to find an API to read it. I can only print it to the screen :


DS:-PrintSystem(sys);

But I'd like to assign the  "tf" printed above (the rational polynomial) into a seaprate variable, so I can extract the numerator and denominator if I want to. I have looked and not able to see a way to read this out. I just started learning this package.

Any idea how to look into these system objects? This does nothing:

o:=DS:-PrintSystem(sys);
whattype(o);
o[1];

Using Maple 18. I am looking for a programmable approach, using code. Not a click and point and menu based solution.

 

According to help here  on display, it says "The options parameter can include plot options as described in the plot/option "  and when  I go to the plots/option I see legend there. But when I try to use it, I get an error that plots:-display does not accept the legened option.

I am generating 2 plots, and use display() to show them on one axes. But need to add a legend as well. Is there a correct way to do this? 

restart:
with(DynamicSystems):
with(plots):
sys := TransferFunction(1/(s^2+0.2*s+1)): 
p1:=ResponsePlot(sys, Step(),duration=50,color=red):
p2:=ImpulseResponsePlot(sys,50);
display([p1,p2],axes=boxed, title=`step and impulse reponses`,legend=["step","impulse"]);

Now if I add legend, it fail

display([p1,p2],axes=boxed, title=`step and impulse reponses`,legend=["step","impulse"]);

I am sure I am doing something wrong. How to add legend to display? I can't use plot([...]) since the plots are allready generated by other Maple functions.

 

 

Can anyone tell me how to scroll the context menus in Maple 17?

I'm using the DynamicSystems pkg and would like to use its context menu but it's cut off at bottom of screen.

When I right click on an expression in a Maple document, I get the context menu,but it goes off the screen at the bottom, and I can't find any way to scroll down to see what is cut off.   I tried the Zoom feature on the menu to make things smaller, and it made the print in my document smaller, but the context menu is the same size, and still gets cut off.

Any help appreciated.

Hi Everybody,

I'm having some problems simulating an algebraic system in Maple.  I want to do this for a larger system of equation (~20 equations/20 variables, with 3 inputs), but I'd like to get an idea of the form this should be in.

So, using an example out of Maple help:

with(DynamicSystems);

sys1:=AlgEquation([y=sin(x)],[x],[y],discrete=true,sampletime=0.001);

inp1:=Vector[column]([1,2,3,4,5,6,7]) * 0.1;

res:=Simulate(sys1,[inp1]);

Error, (in DynamicSystems:-Simulate) should never be here

 

I don't understand what this error means.  Reading the example in the help files, says the second argument should be a vector of input values.  What I would assume this would do is plugin x = 0.1, then solve y=sin(0.1), and output y.

Am I missing some syntax, or is my inputs wrong?  There are examples of how to set up an algebraic system in the help files, but no examples of how to simulate them.

 

Thanks in advance for any help!

 

 

 

 

Example

Diff(x1,t) = x2^2,
Diff(x2,t) = u,
y = x1

result in

Diff(y,t$2)-4*u^2*Diff(y,t) = 0
2*u*x2 - Diff(y,t^2) = 0
x1 - y = 0

is it possible a general and generic method to apply some steps on system below

Diff(u1, t) = u1*u2-u1*u3,
Diff(u2, t) = -u1*u2+u2*u3-(1/2)*(conjugate(u2-u3)*(u1*u2-u1*u3)+conjugate(u1)*(-u1*u2+u2*u3)-conjugate(u1)*(u1*u3-u2*u3))/conjugate(u1),
Diff(u3, t) = u1*u3-u2*u3+(1/2)*(conjugate(u2-u3)*(u1*u2-u1*u3)+conjugate(u1)*(-u1*u2+u2*u3)-conjugate(u1)*(u1*u3-u2*u3))/conjugate(u1),
y = u1

Hi,

I'm searching for the third differential equation that will transform the following two equations non-autonomous system into a three equations autonomous one:

diff(x(t),t)=-x(t)+2*(m*t+n)*y(t)-2*k*(m*t+n)2

diff(y(t),t)=-y(t)+k*m-(m*t+n)*((x(t)/2)-1)

 

diff(z(t),t)= ...

 

Regards,

Johnny

Hello,

I like to plot the Bode diagram of function transfer. For that purpose, i use Dynamicsystem package.

I obtain my transfer function by 2 different methods : 
- direct method
- state space method.

The issue is the fact that i don't obtain the same results with the 2 methods.

 state_space_metho.pdf

hi,

I am trying to make a custom on maple but when i get an error on dynamicSystems saying:

> sys := DynamicSystems[AlgEquation](eq, inputvariable = [Altura(t)], outputvariable = [Teste(t)]);
Error, (in DynamicSystems:-AlgEquation) algebraic equations cannot depend on past/future values of the input/output

But if i change AlgEquation to diffEquation i get no error. I dont have any diff equation on the system. This is happening with one of the "equations":

Hello. I am creating a custom component similar to the one that maplesoft has as an example (the discretized counterflow heat exchanger), but with some diff. The problem is that when i execute dyamic systems i get an error saying:

Error, (in DynamicSystems:-ParseSystemInputs) cannot match the arguments to an appropriate system

Is this a problem on my equation (something that i may have forget) or is another thing? Are the arguments type of dynamic system in the right "type"?

hi,

I am trying to make a simple model of a combustion. To start i am just calculating the composition of the products for a complete combustion and flame´s adiabatic temperature. The equations used to solve the model are:

equations:

nch4 = nco2;
2 * nar = 2 * nco2 + nh2o + 2 * no2;
7.52 * nar = 2 * nn2;
4 * nch4 = 2 * nh2o;
nch4 * hfch4 + nar(hfo2 + 3.76 * hfn2) = nco2(hfco2 + cpco2(Tad - 25)...

plotting using DEplot...

February 13 2012 allen 5

i have a differential equation like below

with(DynamicSystems):

sys1 := diff(y(t), t) = (800-y(t))*y(t)/(100+y(t))-450

with(DETools):

ivs3:=[y(0)=100,y(0)=250,y(0)=800]:

DEplot(sys1,y(t),t=0..1000,ivs3);

i tried to plot this diff equation but received an error message:

Warning, plot may be incomplete, the following error(s) were issued:

> restart:
with(DynamicSystems):
> sys := TransferFunction(1/((1+0.1*s)(1+0.002*s+0.0001*s^2)));
> BodePlot(sys,range=10^(-1)..10^(3));

I get the following warning:
 
             Warning, transfer-function(s) are not rational-polynomial(s) in s



Why?.. How can I make it work without any warning?

Thanks everybody for help!
 
 

Hello:

I am in need of help with Maple Linearize and an exremely crypitc and most un-helpful error message. What does this mean:

> linmod := Linearize(syss, parm, linp);
Error, invalid input: Linearize uses a 4th argument, linpoint (of type {list(`=`), set(`=`)}), which is missing

I can find nothing in the help in this.

Linearize works fine when running a sample program from the help files, but fails when I run my equations.  

1 2 Page 1 of 2