## 10 Reputation

11 years, 73 days

## Thanks and query regarding least square...

Hi Jarekk,

Thanks alot for your reply and solution.  I am really stuck in one more bit thats the least square problem.  leastsquare1.mw

Hope you can help me to solve this bit as well.

Least square method is successfuly implemented in MATLAB code (WRITTEN IN THIS MESSAGE AT THE END), but I couldn't do it in Maple.  I am having problem in the for loop section,  I am attaching Matlab code and  maple code (for correction) pls.

Your help will be really appreciated.

Best Regards

A.Q

Soton

Matlab code as I cannot upload the file:

close all;

clear all;

clc

nr=1500;

Do=190e-3;

Ds=120.8e-3;

la=76e-3;

Qs=36;

p=2;

alpha_p=0.556;

lm=6.3e-3;

g=0.5e-3;

mur=1.045;

Br = 1.16;

Rs=Ds*0.5;

bo=4*Rs*pi/180;

do=0.6e-3;

dslot=17.2e-3;

Mtype='R';

Nlambda=64;

NB=301;

N=128;

Rs=Ds*0.5;

Rm=Rs-g;

Rr=Rs-g-lm;

R=Rs-g*0.5;

Rp1=Rr;

Rp2=Rs;

Rp3=Rs;

Rp4=Rs;

thetas=2*pi/Qs;

alphao=2*asin(0.5*bo/Rs);

theta1=thetas/2-alphao/2;

theta2=theta1+alphao;

clear j

boprime=theta2-theta1;

gprime=log(Rp2/Rp1);

bCM=(boprime/2/gprime+sqrt((boprime/2/gprime)^2+1))^2;

aCM=1/bCM;

clear z_realz_imag

z_imag=j*[0:thetas/N:thetas];

z_real(1:length(z_imag))=log(R);

z=z_real+z_imag;

s=exp(z);

FCM=inline('j*gprime/pi*(log((1+s)/(1-s))-log((b+s)/(b-s))-2*(b-1)/sqrt(b)*atan(s/sqrt(b)))+log(Rp2)+j*theta2',...'s','b','gprime','Rp2','theta2');

%START OPTIMIZATION

w0=[0.01*aCM];

%initial values

for i=1:length(z)

res=@(w0)(FCM(sqrt((w0-bCM)/(w0-aCM)),bCM,gprime,Rp2,theta2)-z(i));

[w(i),resnorm,residual,exitflag]=lsqnonlin(res,w0,[],[]);

k(i)=exp(j*gprime/pi*log(w(i))+log(Rp2)+j*thetas/2);

lambda(i)=k(i)*(w(i)-1)/(w(i)-aCM)^(1/2)/(w(i)-bCM)^(1/2)/s(i);

w0=w(i);

end

lambda=[conj(lambda(N/2+1:-1:1)) lambda(2:N/2)];

figure;plot(real(lambda));grid

figure;plot(imag(lambda));grid

## trigonometry in MAPLE...

Hi all,

I forgot to mention that its a series which I have to convert :

A * sin*theta + B* cos* theta  +  A * sin*theta + B* cos* theta  + A * sin*theta + B* cos* theta  + A * sin*theta + B* cos* theta + A * sin*theta + B* cos* theta

the above series to be converted to:

A*cos*(theta +delta)

Also then I have to multiply

A*cos*(theta + phi) * A*cos(theta + wr t)

where wr = speed in rad  ,  and t = time

Thanks

A.Q. Soton

Thanks Alot acer

Best Regards

Ali

Thanks Alot acer

Best Regards

Ali

## Matrix problem...

Thanks Kitonum

It worked in my problem.

Best Regards

Ali

## Matrix problem...

Thanks Kitonum

It worked in my problem.

Best Regards

Ali

## command...

Thanks Robert for your help.  Yes p is the positive number.  I tried to run the command but unfortunately it didn't completes and takes too long and still no graphs.

I shall be thankful if you can suggest any other way of adding two equations.

Ali Khan

## command...

Thanks Robert for your help.  Yes p is the positive number.  I tried to run the command but unfortunately it didn't completes and takes too long and still no graphs.

I shall be thankful if you can suggest any other way of adding two equations.

Ali Khan

## Thankyou...

Thankyou very much Dr.Kamel for your help

A.Q

A.Q

## Thanks, is it possible to find the four...

Hi Robert

Thanks for the reply, thats what i was looking for,  is there any way i can find a0, an and bn for the fourier transform which is plotted in MAPLE.

Thanks

A.Q

## Thanks, is it possible to find the four...

Hi Robert

Thanks for the reply, thats what i was looking for,  is there any way i can find a0, an and bn for the fourier transform which is plotted in MAPLE.

Thanks

A.Q

## Thanks...

Thanks Dr. Kamel, I will be looking forward to your kind reply.

A.Q

## Thanks...

Thanks Dr. Kamel, I will be looking forward to your kind reply.

A.Q

 1 2 3 4 5 6 Page 5 of 6
﻿