nm

11353 Reputation

20 Badges

13 years, 12 days

MaplePrimes Activity


These are questions asked by nm

I do not like to load a package using with() and then use its commands and functions, since I then lose track knowing from which package a function or command being used in the code came from when I look at the code later on. So I like to write

pkg:-f() or pkg[f]() instead of with(pkg); f()

This seems to work most of the time, except I just found a case where I am forced to do with(pkg) at the top. Here is the example. I'd like to know if there is a workaround where I can avoid with(pkg) in this case as well:

restart;
f:=t->piecewise(t<0,0,t>=0 and t<z,t,t>z,z):
r:=convert(f(t),Heaviside):
r:=inttrans[laplace](r,t,s);


Now since Maple does not know what z is, it could not fully evaluate the result above (I can handle this with assumptions, but this is just an example). So now I replaced z by 0.5, but since laplace is not loaded, it still could not do it:

r:=subs(z=0.5,r);

So now I had to load the package, just to simply the above expression:

with(inttrans);
r;

This all becuase the expression earlier was left with only "laplace" in it, and not "inttrans[laplace]" as I typed. (why this happend, I do not know).

My question is: How would you do the above, without loading the package? I really do not like loading packages as I said, and like to keep the name of the package attached to each function to help me know where each function is coming from.

 

How does one adjust the aspect ratio for Maple plot? I actually searched for aspect ratio for Maple on google and not able to find much of anything. Help does not have such phrase. May be it called something else in Maple? The reason I ask, is that when I change the size of bode plot, the aspect ratio become bad. So I need a way to adjust that. Here is an example

restart:
alias(DS=DynamicSystems):
sys:=DS:-TransferFunction(5*s/(s^2+4*s+25)):
DS:-BodePlot(sys,range=0.1..100);

Now if I do

DS:-BodePlot(sys,range=0.1..100,size=[300,"default"]);

I am finding so many problems with Bodeplot in Maple, but this is for another time. I think it needs much more polishing

Maple 18, windows 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.

 

 

First 187 188 189 190 191 192 193 Last Page 189 of 199