Hmmn, this is a very new approach to me. All this while i have been dealing with differential equations using the dsolve command.
In fact, my earlier work was solving the same set of equations without the time delay term; w(t-a). I used dsolve to solve the equations and the proceeded to make various plots using the odeplot command.
Thanks a lot. I will and try and see if this technique can produce the results i need.
Another question is: What if i have a nonlinear term in x''(t). For example x''(t) = cos(w(t)) + x'(t)? I guess i have to look into nonlinear homogeneous equations?
I have looked into the phase portrait command. It is not entirely what i needed. The phase portrait in Maple plots the solution of a DE against time. The phase portrait i need is first order derivative of the solution against the solution.
I have tried manually solving the equations with dsolve, converting to DE using BlockBuilder and i could not achieve the result i needed.
The following is the latest equation i am dealing with. I could not even solve the DE itself. I tried manual commands, interactive solving, etc.
diff(y(t), t, t) = piecewise(y(t)+diff(y(t), t) > 0, 1, y(t)+diff(y(t), t) < 0, -1)
I have managed to perform the linearization process using the TaylorApproximation command. By far this is the most robust method compared to all the above discussions. It is as dharr recommended:
a) Substitute all the time-dependant terms with non time-dependant terms.
b) Then i substituted all time-derivatives with a preferred term (non time-dependant as well).
c) Use the TaylorApproximation command.
d) Re-substitute with the original terms.
Neat, coordinated and much more less steps (compared to the manual substitutions).
Cheers to all who replied and helped me reached this conclusion.
So now back to my BLOCKBuilder problem. I have tried very hard to include the first order derivative of second order linear ordinary differential equations as the output of the "StateSpace" or "DiffEquation" command, to no success. Please help me out with this one!
Here's a simple example:
de1 := diff(y(t), t, t) = 10*x(t)+2*(diff(y(t), t));
de2 := diff(x(t), t, t) = 2*y(t)+x(t)+u(t);
StateSpace([de1, de2], inputvariable = [u(t)], outputvariable = [y(t), x(t)]);
[[[`State Space`],[continuous],[`2 output(s); 1 input(s); 4 state(s)`],[`inputvariable = `[u(t)]],[`outputvariable = `[y(t),x(t)]],[`statevariable = `[x1(t),x2(t),x3(t),x4(t)]]]
So the problem is what if i want to include diff(y(t), t) as the output as well? including diff(y(t), t) in the outputvariable results in an error message! So how do i do it?
I managed to linearize the equations according to my needs using:
subs with proc, end proc
However, this method is very tedious and requires many substitution steps. I am going to keep trying to do this more robustly. For more understanding of my linearization requirements (for control system analysis and design), please visit:
I am going to try playing around with the TaylorApproximation command since the linearization is actually based on the Taylor series.
A question for you dharr:
Removing the time, t variable first and adding them on with subs is a good suggestion. I was initially wondering how to include derivatives and as i typed this i realised i could replace it with the del operator first (questions always get answered when attempting to ask a question, really strange, ha!)
So i am going to keep testing.
Cheers to all!
I am dealing with a control design problem.
1) I tested this:
A := beta(t);
eval(A, [beta = proc (t) 0 end proc]);
Result is: 0
I changed it to:
A := beta(t)^2;
eval(A, [beta^2 = proc (t) 0 end proc]);
Result is: beta(t)^2
Shouldn't it be zero as well? Cause in the small-angle approximation, a small value multiplied by another small value is extremely small and assumed as zero. But i will require beta(t) to remain as beta(t).
2) That is a good suggestion; listing them and then using them to write the equations. What you mean is listing all of the assumptions with := OR using the subs() command right?
Thanks for all the information so far. I am looking into all the suggestions and doing some 'experimenting'. Will post up my results soon.
Thanks again to all.
Yes indeed the small-angle approximation is similar to Taylor-series expansion.
dharr, i have tested your suggestions and following are several problems i encountered:
1) The TaylorApproximation method does not seem to work on variables that are in terms of time. I tested the commands above and they worked fine. Then i modified the theta and alpha angles to be in terms of time and the command returns error.
An example DE and result of the small-angle approximation would be:
I will continue experimenting. In the meantime, please do share any insights!