Items tagged with matlab matlab Tagged Items Feed

Hi,

On page 32 (PDF)

 

Two different results were obtained using the Global optimization.

Log likelihood does not differ much. BUT the estimates vary a lot, such as mu[p].

tmp.mw

tmp.pdf

 

When I tried to use one of the answer from a particular run, I get the HFLOATING error, see picture.

So how reliable is this? Could there be a better way to optimize this ?

 

Thanks!

 

As an additional note, if I have Matlab R2014a, could I use Matlab to optimize the target function? DO I need to purchase a seperate addon?

 

Hi,


Is it possible to solve linear matrix inequality in Maple?
For example, using Matlab and yalmip we can easily
solve Lyapunov equation
  
    A'P + P * A <0, P> 0

Is it possible to solve this equation in the Maple?


Regards,

 

hi every one,i want to know what are the maple strentgh compraed to matlab and mathematica ? why someone should choose maple instead of these both ? i searched the net,but nothing useful has been found , tnx in advance .

Hi Everybody,

I installed the Maple Toolbox for matlab and tried to run my old code.  For some reason, maple('restart') will cause Matlab to lock up.  Any ideas?

Windows 7 64-bit.  Matlab 2012b 32-bit, Maple 18 32-bit

Hi Mapleprimers,

I'm using CodeGeneration to convert a procedure I obtained with unapply() into a Matlab function.  I'm having problems getting the outputting function to run correctly in Matlab.  I'm going to dynamically generating equations, so directly editing the Matlab code won't work here.  I'm having problems getting any output in Matlab.  Here is the code I'm working on:  Series_addGear_codegen.mw

Ideally I would like output in a matrix.  I've tried putting the unapplied procedure in another procedure, but the CodeGeneration doesn't work.

This is the maple output from the function:

unapp(1,2,3,4,5);
{BAT_A = -2.267032891, BAT_V = 271, EM2_A = .4615464218, EM2_P = 125.0790803, EM2_T = -1, EM2_V = 271, EM2_W = 2, GBa_T = 12, GBa_W = 5/3, GBb_T = -4, GBb_W = 5, GEN_A = 1.805486469, GEN_P = 489.2868330, GEN_T = -12, GEN_V = 271, GEN_W = 5/3, ICE_mdot_g = 20}

Since I'll know the order of variables, I want the Matlab function to output:

[-2.267032891,  271,  .4615464218,  125.0790803,  -1, ...]

This is the output after putting the Matlab function in Matlab:

>> unapp(1, 1, 1, 1, 1)
Undefined function or variable 'BAT_A'.

Error in unapp (line 39)
unappreturn = unique([BAT_A == -t35 / 0.271e3 - t73 / 0.271e3 BAT_V == 271 EM2_A == t35 /
0.271e3 EM2_P == t35 EM2_T == -FD_T EM2_V == 271 EM2_W == FD_W GBa_T == t44 GBa_W == t41 GBb_T
== -ICE_T GB

This is the Matlab code that is generated by Maple 18:

MCode:=CodeGeneration[Matlab](unapp, declare = [FD_T::float, FD_W::float, GB_R::float, ICE_T::float, ICE_W::float],defaulttype=float,optimize,defaulttype = numeric);
Warning, could not preprocess. Found `abs` or similar in the 'While'/'For' conditions.
Warning, procedure/module options ignored
function unappreturn = unapp(FD_T, FD_W, GB_R, ICE_T, ICE_W)
t2 = 0.1e1 * FD_T * FD_W;
t5 = abs(FD_W);
t7 = abs(FD_T);
t9 = t5 ^ 2;
t13 = t7 ^ 2;
t15 = t9 * t5;
t21 = t13 * t7;
t23 = t9 ^ 2;
t31 = t13 ^ 2;
t33 = 0.1483000000e3 - 0.4267000000e1 * t5 - 0.1277000000e2 * t7 + 0.3640000000e-1 * t9 - 0.1160000000e1 * t5 * t7 + 0.2580000000e0 * t13 - 0.1181000000e-3 * t15 + 0.5994000000e-3 * t9 * t7 - 0.1171000000e-3 * t5 * t13 - 0.1739000000e-2 * t21 + 0.1245000000e-6 * t23 - 0.1200000000e-5 * t15 * t7 + 0.1584000000e-5 * t9 * t13 - 0.4383000000e-6 * t5 * t21 + 0.2947000000e-5 * t31;
if (-t2 == 0.0e0)
t35 = 0.0e0;
elseif (-t2 < 0.0e0)
t35 = t33;
else
t35 = -t33;
end
t36 = ICE_T * ICE_W;
t37 = 0.1e1 * t36;
t41 = ICE_W / GB_R;
t42 = abs(t41);
t44 = ICE_T * GB_R;
t45 = abs(t44);
t47 = t42 ^ 2;
t51 = t45 ^ 2;
t53 = t47 * t42;
t59 = t51 * t45;
t61 = t47 ^ 2;
t69 = t51 ^ 2;
t71 = 0.5280000000e-11 - 0.3849000000e-13 * t42 + 0.7190000000e2 * t45 + 0.1168000000e-15 * t47 - 0.1296000000e1 * t42 * t45 - 0.2489000000e1 * t51 - 0.1451000000e-18 * t53 - 0.1326000000e-3 * t47 * t45 + 0.8141000000e-2 * t42 * t51 + 0.4539000000e-2 * t59 + 0.6325000000e-22 * t61 + 0.2091000000e-6 * t53 * t45 - 0.3455000000e-5 * t47 * t51 - 0.2499000000e-4 * t42 * t59 + 0.5321000000e-4 * t69;
if (-t37 == 0.0e0)
t73 = 0.0e0;
elseif (-t37 < 0.0e0)
t73 = t71;
else
t73 = -t71;
end
unappreturn = unique([BAT_A == -t35 / 0.271e3 - t73 / 0.271e3 BAT_V == 271 EM2_A == t35 / 0.271e3 EM2_P == t35 EM2_T == -FD_T EM2_V == 271 EM2_W == FD_W GBa_T == t44 GBa_W == t41 GBb_T == -ICE_T GBb_W == ICE_W GEN_A == t73 / 0.271e3 GEN_P == t73 GEN_T == -t44 GEN_V == 271 GEN_W == t41 ICE_mdot_g == t36]);

 

 

Hi MaplePrime-ers,

I'm using Maple17 in Matlab 2012b to evaluate a symbolic function over a grid of values.  The number of values is generally ~500k, and therefore I have a loop that dumps the solutions into MATLAB where the values are parsed and stored more efficiently.

I put this proceess in an optimization routine, and I keep getting crashes.  The crashes are NOT repeatable.  They generally happen after 4-10 times the routine has been called.  

This is one of the stack dumps.  Anybody have any ideas?  I talked to MATLAB support, but they weren't very useful (they started pointing fingers).


------------------------------------------------------------------------
Segmentation violation detected at Wed Jun 4 17:38:11 2014
------------------------------------------------------------------------

Configuration:
Crash Decoding : Disabled
Current Visual : 0x24 (class 4, depth 24)
Default Encoding: UTF-8
GNU C Library : 2.15 stable
MATLAB Root : /opt/Matlab/R2012b
MATLAB Version : 8.0.0.783 (R2012b)
Operating System: Linux 3.2.0-37-generic #58-Ubuntu SMP Thu Jan 24 15:28:10 UTC 2013 x86_64
Processor ID : x86 Family 6 Model 23 Stepping 6, GenuineIntel
Virtual Machine : Java 1.6.0_17-b04 with Sun Microsystems Inc. Java HotSpot(TM) 64-Bit Server VM mixed mode
Window System : The XFree86 Project, Inc (40300000), display wildnode0:15.0

Fault Count: 1


Abnormal termination:
Segmentation violation

Register State (from fault):
RAX = 00007f3bcc0a80c0 RBX = 00007f3b97fe6000
RCX = 0000000000000000 RDX = 00007f3bcc0a84a0
RSP = 00007f3b8cb29d60 RBP = 0000000000000003
RSI = 5851f42d4c957f2d RDI = 00007f3bde026360

R8 = 65a1566174cc9e28 R9 = 0000000000000002
R10 = 00007f3b8cb29d90 R11 = 0000000000002e88
R12 = 0000000000000001 R13 = 00007f3b8cb29df0
R14 = 0000000000000000 R15 = 0000000000000003

RIP = 00007f3b977d0604 EFL = 0000000000010283

CS = 0033 FS = 0000 GS = 0000

Stack Trace (from fault):
[ 0] 0x00007f3c962b01de /opt/Matlab/R2012b/bin/glnxa64/libmwfl.so+00516574 _ZN2fl4diag15stacktrace_base7captureERKNS0_14thread_contextEm+000158
[ 1] 0x00007f3c962b14b2 /opt/Matlab/R2012b/bin/glnxa64/libmwfl.so+00521394
[ 2] 0x00007f3c962b2ffe /opt/Matlab/R2012b/bin/glnxa64/libmwfl.so+00528382 _ZN2fl4diag13terminate_logEPKcRKNS0_14thread_contextE+000174
[ 3] 0x00007f3c9559f093 /opt/Matlab/R2012b/bin/glnxa64/libmwmcr.so+00557203 _ZN2fl4diag13terminate_logEPKcPK8ucontext+000067
[ 4] 0x00007f3c9559bb9d /opt/Matlab/R2012b/bin/glnxa64/libmwmcr.so+00543645
[ 5] 0x00007f3c9559d835 /opt/Matlab/R2012b/bin/glnxa64/libmwmcr.so+00550965
[ 6] 0x00007f3c9559da55 /opt/Matlab/R2012b/bin/glnxa64/libmwmcr.so+00551509
[ 7] 0x00007f3c9559e0fe /opt/Matlab/R2012b/bin/glnxa64/libmwmcr.so+00553214
[ 8] 0x00007f3c9559e295 /opt/Matlab/R2012b/bin/glnxa64/libmwmcr.so+00553621
[ 9] 0x00007f3c93a86cb0 /lib/x86_64-linux-gnu/libpthread.so.0+00064688
[ 10] 0x00007f3b977d0604 /opt/maple17/bin.X86_64_LINUX/libmaple.so+01824260
[ 11] 0x00007f3b977cfc48 /opt/maple17/bin.X86_64_LINUX/libmaple.so+01821768
[ 12] 0x00007f3b977d2f88 /opt/maple17/bin.X86_64_LINUX/libmaple.so+01834888
[ 13] 0x00007f3b9763d63f /opt/maple17/bin.X86_64_LINUX/libmaple.so+00173631
[ 14] 0x00007f3c93a7ee9a /lib/x86_64-linux-gnu/libpthread.so.0+00032410
[ 15] 0x00007f3c937ab3fd /lib/x86_64-linux-gnu/libc.so.6+01000445 clone+000109


If this problem is reproducible, please submit a Service Request via:
http://www.mathworks.com/support/contact_us/

A technical support engineer might contact you with further information.

Thank you for your help.

 

 

i have a large angle and i wish to represent this angle called theta in the range [0 2*Pi]. In matlab this is done by the command mod(theta, 2* Pi). ihave tried frem and mod in maple but the two cannot accept 2*Pi as a second argument 

how can i do that 

Hello;

I would like to extract data from a 2D plot to compare my numerical result in Matlab. 

I used this command.

However, I need to spesify the nodes on x axis to get the error in Matlab. My matlab codes give the result as fix step size i.e [0 0.1 0.2 ... 1.0] or [0 0.01 0.02 ... 1.00] etc.

Is there any command in Maple to spesify the nodes on x axis?

Thanks you!

Hi all

In matlab software we have a command namely fmincon which minimizes any linear/nonlinear algebric equations subject to linear/nonlinear constraints.

Now my question is that: what is the same command in maple?or how can we minimize linear/nonlinear function subject to linear/nonlinear constraints in maple?

thanks a lot

Mahmood   Dadkhah

Ph.D Candidate

Applied Mathematics Department

Hi MaplePrime-ers!

I've been using the Maple(17) toolbox in Matlab(2012b) to quickly enumerate systems of equations by: (i) solving them symbolically, (ii) using unapply to make them functions, (iii) then supplying the points (driver equations) to get the system solution.  Speed is a must, because there may be 3 million+ systems to solve.  Symbolics is also very important because I am evaluating topology, so the structure of the equations may change, and therefore a functional approach will not work.

I have had success (seen in the first code snippet).  I would like similiar behaviour in the second code snippet, but sometimes I get 'solutions may be lost' as an error message,  or 'Error, (in unapply) variables must be unique and of type name'

The system of equations include:  Linear equations, 5th order polynomials, absolute functions, and pieceiwse functions.

Here is code with a topology that solves:

#Interconnection Equations
eq2[1] := FD_T + EM2_T = 0;
eq2[2] := ICE_T + GEN_T = 0;
eq2[3] := EM2_A + GEN_A + BAT_A = 0;
eq2[4] := -FD_W + EM2_W = 0;
eq2[5] := -ICE_W + GEN_W = 0;
eq2[6] := -EM2_V + GEN_V = 0;
eq2[7] := -EM2_V + BAT_V = 0;

#ICE
eq_c[1] := ICE_mdot_g=((671.5) + (-21.94)*ICE_T + (0.1942)*ICE_W + (0.5113)*ICE_T^2 + (-0.01271)*ICE_T*ICE_W + ( -0.0008761)*ICE_W^2 + (-0.006071)*ICE_T^3 + (9.867e-07)*ICE_T^2*ICE_W + (5.616e-05)*ICE_T*ICE_W^2 + (1.588e-06)*ICE_W^3 + (3.61e-05)*ICE_T^4 + (8.98e-07)*ICE_T^3*ICE_W + (-2.814e-07)*ICE_T^2*ICE_W^2 + (-8.121e-08)*ICE_T*ICE_W^3 + ( -8.494e-08 )*ICE_T^5 + (-2.444e-09)*ICE_T^4*ICE_W + (-9.311e-10)*ICE_T^3*ICE_W^2 + ( 5.835e-10)*ICE_T^2*ICE_W^3 ) *1/3600/1000 * ICE_T * ICE_W;

#BAT
eq_c[2] := BAT = 271;

#EM2
EM2_ReqPow_eq := (-148.3) + (4.267)*abs(EM2_W) + (12.77)*abs(EM2_T) + (-0.0364)*abs(EM2_W)^2 + ( 1.16)*abs(EM2_W)*abs(EM2_T) + (-0.258)*abs(EM2_T)^2 + ( 0.0001181)*abs(EM2_W)^3 + (-0.0005994)*abs(EM2_W)^2*abs(EM2_T) + ( 0.0001171)*abs(EM2_W)*abs(EM2_T)^2 + (0.001739 )*abs(EM2_T)^3 + (-1.245e-07 )*abs(EM2_W)^4 + ( 1.2e-06)*abs(EM2_W)^3*abs(EM2_T) + ( -1.584e-06)*abs(EM2_W)^2*abs(EM2_T)^2 + ( 4.383e-07)*abs(EM2_W)*abs(EM2_T)^3 + (-2.947e-06)*abs(EM2_T)^4;
eq_c[3] := EM2_P = piecewise( EM2_T = 0, 0, EM2_W = 0, 0, EM2_W*EM2_T < 0,-1 * EM2_ReqPow_eq, EM2_ReqPow_eq);
eq_c[4] := EM2_A = EM2_P/EM2_V;

#GEN
GEN_ReqPow_eq:= (-5.28e-12) + ( 3.849e-14)*abs(GEN_W) + (-71.9)*abs(GEN_T) + (-1.168e-16)*abs(GEN_W)^2 +(1.296)*abs(GEN_W)*abs(GEN_T) + (2.489)*abs(GEN_T)^2 + (1.451e-19)*abs(GEN_W)^3 + (0.0001326)*abs(GEN_W)^2*abs(GEN_T) + (-0.008141)*abs(GEN_W)*abs(GEN_T)^2 + (-0.004539)*abs(GEN_T)^3 +(-6.325e-23)*abs(GEN_W)^4 + (-2.091e-07)*abs(GEN_W)^3*abs(GEN_T) + ( 3.455e-06)*abs(GEN_W)^2*abs(GEN_T)^2 + ( 2.499e-05)*abs(GEN_W)*abs(GEN_T)^3 + (-5.321e-05)*abs(GEN_T)^4;
eq_c[5] := GEN_P = piecewise( GEN_T = 0, 0, GEN_W = 0, 0, GEN_W*GEN_T < 0,-1 * GEN_ReqPow_eq, GEN_ReqPow_eq);
eq_c[6] := GEN_A = GEN_P/GEN_V;

#ASSUMPTIONS
assume(BAT_V::nonnegative);
assume(FD_W::nonnegative);

#FINAL EQUATIONS

sys_eqs2 := convert(eq2,set) union {eq_c[1],eq_c[2],eq_c[3],eq_c[4],eq_c[5],eq_c[6]};

#Selecting which variables to solve for:

drivers2:= { ICE_T,ICE_W,FD_T,FD_W};
symvarnames2:=select(type,indets(convert(sys_eqs2,list)),name);
notdrivers2:=symvarnames2 minus drivers2;


#Symbolic solve

sol2:=solve(sys_eqs2,notdrivers2) assuming real:
symb_sol2:=unapply(sol2,convert(drivers2,list)):


#Enumerate (there will generally be about 40, not 6)

count := 0;
for i1 from 1 to 40 do
     for i2 from 1 to 40 do
          for i3 from 1 to 40 do
               for i4 from 1 to 40 do
                    count := count + 1;
                    solsol2(count) := symb_sol2(i1,i2,i3,i4);
               od;
          od;
     od;
od;
count;



This works great!  I would like simliar output in my second code snippet, but this time with more inputs to symb_sol.  However, if I try and change the interconnection equations a little, and add a piecewise function, and another driver... (differences in bold)

#Interconnection Equations
eq1[1] := FD_T+EM2_T = 0;
eq1[2] := ICE_T+GBb_T = 0;
eq1[3] := GEN_T+GBa_T = 0;
eq1[4] := EM2_A+GEN_A+BAT_A = 0;
eq1[5] := -FD_W+EM2_W = 0;
eq1[6] := -GEN_W+GBa_W = 0;
eq1[7] := -ICE_W+GBb_W = 0;
eq1[8] := -EM2_V+GEN_V = 0;
eq1[9] := -EM2_V+BAT_V = 0;

#ICE
eq_c[1] := ICE_mdot_g=((671.5) + (-21.94)*ICE_T + (0.1942)*ICE_W + (0.5113)*ICE_T^2 + (-0.01271)*ICE_T*ICE_W + ( -0.0008761)*ICE_W^2 + (-0.006071)*ICE_T^3 + (9.867e-07)*ICE_T^2*ICE_W + (5.616e-05)*ICE_T*ICE_W^2 + (1.588e-06)*ICE_W^3 + (3.61e-05)*ICE_T^4 + (8.98e-07)*ICE_T^3*ICE_W + (-2.814e-07)*ICE_T^2*ICE_W^2 + (-8.121e-08)*ICE_T*ICE_W^3 + ( -8.494e-08 )*ICE_T^5 + (-2.444e-09)*ICE_T^4*ICE_W + (-9.311e-10)*ICE_T^3*ICE_W^2 + ( 5.835e-10)*ICE_T^2*ICE_W^3 ) *1/3600/1000 * ICE_T * ICE_W;

#BAT
eq_c[2] := BAT = 271;

#EM2
EM2_ReqPow_eq := (-148.3) + (4.267)*abs(EM2_W) + (12.77)*abs(EM2_T) + (-0.0364)*abs(EM2_W)^2 + ( 1.16)*abs(EM2_W)*abs(EM2_T) + (-0.258)*abs(EM2_T)^2 + ( 0.0001181)*abs(EM2_W)^3 + (-0.0005994)*abs(EM2_W)^2*abs(EM2_T) + ( 0.0001171)*abs(EM2_W)*abs(EM2_T)^2 + (0.001739 )*abs(EM2_T)^3 + (-1.245e-07 )*abs(EM2_W)^4 + ( 1.2e-06)*abs(EM2_W)^3*abs(EM2_T) + ( -1.584e-06)*abs(EM2_W)^2*abs(EM2_T)^2 + ( 4.383e-07)*abs(EM2_W)*abs(EM2_T)^3 + (-2.947e-06)*abs(EM2_T)^4;
eq_c[3] := EM2_P = piecewise( EM2_T = 0, 0, EM2_W = 0, 0, EM2_W*EM2_T < 0,-1 * EM2_ReqPow_eq, EM2_ReqPow_eq);
eq_c[4] := EM2_A = EM2_P/EM2_V;

#GEN
GEN_ReqPow_eq:= (-5.28e-12) + ( 3.849e-14)*abs(GEN_W) + (-71.9)*abs(GEN_T) + (-1.168e-16)*abs(GEN_W)^2 +(1.296)*abs(GEN_W)*abs(GEN_T) + (2.489)*abs(GEN_T)^2 + (1.451e-19)*abs(GEN_W)^3 + (0.0001326)*abs(GEN_W)^2*abs(GEN_T) + (-0.008141)*abs(GEN_W)*abs(GEN_T)^2 + (-0.004539)*abs(GEN_T)^3 +(-6.325e-23)*abs(GEN_W)^4 + (-2.091e-07)*abs(GEN_W)^3*abs(GEN_T) + ( 3.455e-06)*abs(GEN_W)^2*abs(GEN_T)^2 + ( 2.499e-05)*abs(GEN_W)*abs(GEN_T)^3 + (-5.321e-05)*abs(GEN_T)^4;
eq_c[5] := GEN_P = piecewise( GEN_T = 0, 0, GEN_W = 0, 0, GEN_W*GEN_T < 0,-1 * GEN_ReqPow_eq, GEN_ReqPow_eq);
eq_c[6] := GEN_A = GEN_P/GEN_V;

#GB
FiveSpeedGearbox_R := proc(ig)
local i ,eq;
i[1]:=3.32;
i[2]:=2;
i[3]:=1.36;
i[4]:=1.01;
i[5]:=0.82;
eq:= piecewise(ig=1,i[1],ig=2, i[2],ig=3,i[3],ig=4,i[4],ig=5,i[5],1);
return eq(ig);
end proc;


eq_c[7] := GBb_T = -1/GB_R * GBa_T;
eq_c[8] := GBb_W = GB_R * GBa_W;
eq_c[9] := GB_R = FiveSpeedGearbox_R(ig);

 

#System Equations
sys_eqs := convert(eq1,set) union convert(eq_c,set);

 

 #Solve for variables
symvarnames:=select(type,indets(convert(sys_eqs,list)),name);
drivers:= {ig, ICE_T,ICE_W,FD_T,FD_W};
not_drivers := symvarnames minus drivers;

#Assumptinons

assume(BAT_V::nonnegative);
assume(FD_W::nonnegative);

sol:=(solve(sys_eqs,not_drivers) assuming real);

symb_sol:=unapply(sol,convert(drivers,list)): ---> Error, (in unapply) variables must be unique and of type name

Subsequent parts don't work...

count := 0;
for i1 from 1 to 40 do
     for i2 from 1 to 40 do
          for i3 from 1 to 40 do
               for i4 from 1 to 40 do
                    for i5 from 1 to 40 do
                         count := count + 1;
                         solsol2(count) := symb_sol2(i1,i2,i3,i4,5);
                    od;
               od; 
          od;
     od;
od;
count;

While running the last line sol:, 1 of 2 things will happen, depending on the solver. Maple17 will take a long time (30+ minutes) to solve, then report nothing, or sol will solve, but will report "some solutions have been lost".

Afterwards, evaluating symb_sol(0,0,0,0,0) will return a viable solution (real values for each of the variables).  Whereas evaluating symb_sol(0,X,0,0,0), where X <> 0, will return and empty list [].

Does anyone know how to (i) speed up the symbolic solve time?  (ii) Return ALL of the solutions?

 

Thanks in advance for reading this.  I've really no idea why this isn't working.  I've also attached two worksheets with the code: noGB.mw   withGB.mw

 Adam

Dear all

I would like to convert Matlab code to Maple, is there anu idea, this is the code.

 

% Usage: [y t] = abm4(f,a,b,ya,n) or y = abm4(f,a,b,ya,n)
% Adams-Bashforth-Moulton 4-th order predictor-corrector method for initial value problems
% It uses
% Adams-Bashforth 4-step method as a precdictor,
% Adams-Moulton 3-step method as a corrector, and
% Runge-Kutta method of order 4 as a starter
%
% Input:
% f - Matlab inline function f(t,y)
% a,b - interval
% ya - initial condition
% n - number of subintervals (panels)
%
% Output:
% y - computed solution
% t - time steps
%
% Examples:
% [y t]=abm4(@myfunc,0,1,1,10);          here 'myfunc' is a user-defined function in M-file
% y=abm4(inline('sin(y*t)','t','y'),0,1,1,10);
% f=inline('sin(y(1))-cos(y(2))','t','y');
% y=abm4(f,0,1,1,10);

function [y t] = abm4(f,a,b,ya,n)
h = (b - a) / n;
h24 = h / 24;

y(1,:) = ya;
t(1) = a;

m = min(3,n);

for i = 1 : m % start-up phase, using Runge-Kutta of order 4
    t(i+1) = t(i) + h;
    s(i,:) = f(t(i), y(i,:));
    s2 = f(t(i) + h / 2, y(i,:) + s(i,:) * h /2);
    s3 = f(t(i) + h / 2, y(i,:) + s2 * h /2);
    s4 = f(t(i+1), y(i,:) + s3 * h);
    y(i+1,:) = y(i,:) + (s(i,:) + s2+s2 + s3+s3 + s4) * h / 6;
end;

for i = m + 1 : n % main phase
    s(i,:) = f(t(i), y(i,:));
    y(i+1,:) = y(i,:) + (55 * s(i,:) - 59 * s(i-1,:) + 37 * s(i-2,:) - 9 * s(i-3,:)) * h24; % predictor
    t(i+1) = t(i) + h;
    y(i+1,:) = y(i,:) + (9 * f(t(i+1), y(i+1,:)) + 19 * s(i,:) - 5 * s(i-1,:) + s(i-2,:)) * h24; % corrector
end;

I have 2 problem with my jacobian matrix:

first: i can not evaluate 11*11 jacobian matrix. at last i can evaluate 10*10 matrix. can i solve this?
second: i want to export my matrix for matlab but i see this error : {export matrix"cannot convert matrix element to float[8] data type"}
so how i can use this matrix in my matlab code?
 my jacobian matrix:


with(VectorCalculus); Jacobian([VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`*`(2.68, ex), VectorCalculus:-`-`(VectorCalculus:-`*`(2, vx))), VectorCalculus:-`*`(VectorCalculus:-`*`(VectorCalculus:-`*`(VectorCalculus:-`*`(VectorCalculus:-`*`(3.500000001, e^VectorCalculus:-`*`(1.666666667, sqrt(VectorCalculus:-`+`(VectorCalculus:-`-`(VectorCalculus:-`+`(sqrt(VectorCalculus:-`+`(rx^2, ry^2)), sqrt(VectorCalculus:-`+`(VectorCalculus:-`+`(rx, VectorCalculus:-`-`(VectorCalculus:-`*`(2, vb(ex))))^2, VectorCalculus:-`+`(ry, VectorCalculus:-`-`(VectorCalculus:-`*`(2, vb(ey))))^2)))^2), VectorCalculus:-`-`(VectorCalculus:-`*`(4, vb^2)))))), VectorCalculus:-`+`(sqrt(VectorCalculus:-`+`(rx^2, ry^2)), sqrt(VectorCalculus:-`+`(VectorCalculus:-`+`(rx, VectorCalculus:-`-`(VectorCalculus:-`*`(2, vb(ex))))^2, VectorCalculus:-`+`(ry, VectorCalculus:-`-`(VectorCalculus:-`*`(2, vb(ey))))^2)))), VectorCalculus:-`+`(VectorCalculus:-`*`(rx, 1/sqrt(VectorCalculus:-`+`(rx^2, ry^2))), VectorCalculus:-`*`(1/2, VectorCalculus:-`*`(VectorCalculus:-`+`(VectorCalculus:-`*`(2, rx), VectorCalculus:-`-`(VectorCalculus:-`*`(4, vb(ex)))), 1/sqrt(VectorCalculus:-`+`(VectorCalculus:-`+`(rx, VectorCalculus:-`-`(VectorCalculus:-`*`(2, vb(ex))))^2, VectorCalculus:-`+`(ry, VectorCalculus:-`-`(VectorCalculus:-`*`(2, vb(ey))))^2)))))), ln(e)), 1/sqrt(VectorCalculus:-`+`(VectorCalculus:-`-`(VectorCalculus:-`+`(sqrt(VectorCalculus:-`+`(rx^2, ry^2)), sqrt(VectorCalculus:-`+`(VectorCalculus:-`+`(rx, VectorCalculus:-`-`(VectorCalculus:-`*`(2, vb(ex))))^2, VectorCalculus:-`+`(ry, VectorCalculus:-`-`(VectorCalculus:-`*`(2, vb(ey))))^2)))^2), VectorCalculus:-`-`(VectorCalculus:-`*`(4, vb^2)))))), VectorCalculus:-`*`(VectorCalculus:-`*`(VectorCalculus:-`*`(VectorCalculus:-`*`(50.00000000, e^VectorCalculus:-`-`(VectorCalculus:-`*`(5.000000000, sqrt(VectorCalculus:-`+`(Rx^2, Ry^2))))), Rx), ln(e)), 1/sqrt(VectorCalculus:-`+`(Rx^2, Ry^2)))), VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`+`(VectorCalculus:-`*`(2.68, ey), VectorCalculus:-`-`(VectorCalculus:-`*`(2, vy))), VectorCalculus:-`*`(VectorCalculus:-`*`(VectorCalculus:-`*`(VectorCalculus:-`*`(VectorCalculus:-`*`(3.500000001, e^VectorCalculus:-`*`(1.666666667, sqrt(VectorCalculus:-`+`(VectorCalculus:-`-`(VectorCalculus:-`+`(sqrt(VectorCalculus:-`+`(rx^2, ry^2)), sqrt(VectorCalculus:-`+`(VectorCalculus:-`+`(rx, VectorCalculus:-`-`(VectorCalculus:-`*`(2, vb(ex))))^2, VectorCalculus:-`+`(ry, VectorCalculus:-`-`(VectorCalculus:-`*`(2, vb(ey))))^2)))^2), VectorCalculus:-`-`(VectorCalculus:-`*`(4, vb^2)))))), VectorCalculus:-`+`(sqrt(VectorCalculus:-`+`(rx^2, ry^2)), sqrt(VectorCalculus:-`+`(VectorCalculus:-`+`(rx, VectorCalculus:-`-`(VectorCalculus:-`*`(2, vb(ex))))^2, VectorCalculus:-`+`(ry, VectorCalculus:-`-`(VectorCalculus:-`*`(2, vb(ey))))^2)))), VectorCalculus:-`+`(VectorCalculus:-`*`(ry, 1/sqrt(VectorCalculus:-`+`(rx^2, ry^2))), VectorCalculus:-`*`(1/2, VectorCalculus:-`*`(VectorCalculus:-`+`(VectorCalculus:-`*`(2, ry), VectorCalculus:-`-`(VectorCalculus:-`*`(4, vb(ey)))), 1/sqrt(VectorCalculus:-`+`(VectorCalculus:-`+`(rx, VectorCalculus:-`-`(VectorCalculus:-`*`(2, vb(ex))))^2, VectorCalculus:-`+`(ry, VectorCalculus:-`-`(VectorCalculus:-`*`(2, vb(ey))))^2)))))), ln(e)), 1/sqrt(VectorCalculus:-`+`(VectorCalculus:-`-`(VectorCalculus:-`+`(sqrt(VectorCalculus:-`+`(rx^2, ry^2)), sqrt(VectorCalculus:-`+`(VectorCalculus:-`+`(rx, VectorCalculus:-`-`(VectorCalculus:-`*`(2, vb(ex))))^2, VectorCalculus:-`+`(ry, VectorCalculus:-`-`(VectorCalculus:-`*`(2, vb(ey))))^2)))^2), VectorCalculus:-`-`(VectorCalculus:-`*`(4, vb^2)))))), VectorCalculus:-`*`(VectorCalculus:-`*`(VectorCalculus:-`*`(VectorCalculus:-`*`(50.00000000, e^VectorCalculus:-`-`(VectorCalculus:-`*`(5.000000000, sqrt(VectorCalculus:-`+`(Rx^2, Ry^2))))), Ry), ln(e)), 1/sqrt(VectorCalculus:-`+`(Rx^2, Ry^2)))), 1, 1, 1, 1, 1, 1, 1, 1, 1], [vx, vy, ex, ey, rx, ry, Ex, Ey, vb, Rx, Ry])

Hello,

I was wondering if I can call Matlab R2012b with maple 14 on my macos 10.7.5.

When I try to do this:

> Matlab[setvar]("x", 3.14);

I get this:


Error, (in Matlab:-setvar) there was a problem finding or loading matlink.so. Refer to ?Matlab,setup for help configuring your system to work with the Matlab-link.

I read that I may have to change a script. Where are those scripts located?

Regards,

Hi all

I want to simulate the threshold effect in FM modulation\ demodulation, in theory ,when the carrier to noise ratio (the modulated signal SNR)fall below a certain value ,then the signal to noise ratio(of the demodulated signal will fall dramatically and the signal will not demodulated , click sounds will be heard in the output of demodulator. I have tried first "slope detector" as a demodulator, but the threshold effect didn't appear at all when i decrease...

1 2 3 4 Page 1 of 4