ibrdmmache

0 Reputation

2 Badges

12 years, 325 days

MaplePrimes Activity


These are replies submitted by ibrdmmache

Hello,

i would like to convert a maple code in a matlab code.

I don't now how to use the CodeGenartion function for converting the maple code to matlab code.

For information, i'm using version 16 of Maple.

Here is the maple code:

> restart;

> p=float;

                       

> q=float;

 

> z= complex[8];

 

>

> n1:=(z-1)*(z-1+p+q):

> n2:=(z^(-1)-1)*(z^(-1)-1+p+q):

> d1:= z^3+(2*p-1)*z^2+(p^2-(1-q)^2)*z+(1-p-q)^2:

> d2:= z^(-3)+(2*p-1)*z^(-2)+(p^2-(1-q)^2)*z^(-1)+(1-p-q)^2:

> WW:=(p*q*(2-p-q)*n1*n2)/((p+q)*d1*d2):

> simplify(WW);

 

> NN:=101;

> PLOOT:=array(1..NN):

> p:=1;

 

> q:=0.5;

> with(codegen,fortran):

> for ii from 1  to NN do

> freq:=(1.0/(NN-1))*(ii-1):

>

>

> z:=exp(2*Pi*freq*I):

> WW:=(p*q*(2-p-q)*n1*n2)/((p+q)*d1*d2):

 

>

> P1:=simplify(WW);

> P2:=sqrt(P1*conjugate(P1)):

> PS1:=Re(P2);

> PS:=simplify(PS1):

> PLOOT[ii]:=PS:

> end do:

> with(plots):

 

> #points:= { PLOOT([j],j=1..11) }:

> pointplot({seq ([j,PLOOT[j]],j=1..NN)});

 

> #plot(PS,freq=0..1,title="W(f)\nBip_Encod");

>

 

 

Think's for you

Ibrdmmache@gmail.com

Page 1 of 1