f



Please help. just last small problem in using the vector output from ODE in another equation. please help

Dear Torsten,
 
thank you very much for your kind help. i have written the code and its almost done but now only one small problem remains, here is the code that i wrote down;


function maxwellbloch
t=linspace(0,5,10);%the non dimensionalized characteritic time
z=linspace(0,5,10);%the non dimensionalized characteristic length
s=[1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1]; %The intitial values E(z,0) included for ten grid points, E(2),E(3),...,E(10)
[t,y]=ode45(@salman3,t,s);
meshgrid(t,z);
surf(t,z,E)
function dydt=salman3(t,y,E)
z=linspace(0,5,10);
dydt=zeros(size(y));

y(1);y(2);y(3);y(4);y(5);y(6);y(7);y(8);y(9);y(10);y(11);y(12);y(13);y(14);y(15);y(16);y(17);y(18); 
f=10; %Ten discretization points along the distance grid
E(1)=0;%Boundary condition for the wave E(0,t)=2 supposed here;
for j=10:9+f-1
    E(j-10+2)=y(j);
end
for j=2:length(z)
   dEdt(j)=-(E(j)-E(j-1))/(z(j)-z(j-1))+i*y(3);
  end
  
%--------------------------------------------------
k5=1000000000;
k2=10*i*k5/2; 
k1=k2/3; 
k3=100; 
k4=k5/2; 
k6=k4; 
%------------------------------------------------------
dydt(1)=-k1*y(3)+k1*y(7)+k5*y(9);
dydt(5)=-k2*y(6)+k2*y(8);
dydt(9)=k1*y(3)+k2*y(6)-k1*y(7)-k2*y(8)-k5*y(9);
dydt(2)=-k3*y(2)-k2*y(3)+k1*y(8);
dydt(3)=-k1*y(1)-k2*y(2)-k4*y(3)+k1*y(9);
dydt(4)=-k3*y(4)-k1*y(6)+k2*y(7);   
dydt(6)=-k1*y(4)-k2*y(5)+k2*y(9)-k6*y(6);
dydt(7)=k1*y(1)+k2*y(4)-k4*y(7)-k1*y(9);
dydt(8)=k1*y(2)+k2*y(5)-k6*y(8);
for j=10:9+f-1
    dydt(j)=dEdt(j-10+2);
end 
for m=2:length(z)
    dEdt(m)=-(E(m)-E(m-1))/(z(m)-z(m-1))+i*y(3);
end

   the problem is; as you mentioned to write 
for j=2:length(z)
   dEdt(j)=...;
  end

what should i write here? as the original equation that i wanted to solve is written in the final portion of the code, like;

for m=2:length(z)
    dEdt(m)=-(E(m)-E(m-1))/(z(m)-z(m-1))+i*y(3);
end

so i am confused with this, what should i declare here for dEdt(j)-...;

also if i want to get plot of E(z,t) vs t and z, is the meshgrid and the surf command ok that i wrote above just after calling the ode45 solver?

i will highly appreciate your help.

thanks alot.
0
5/11/2011 6:12:05 AM
comp.soft-sys.matlab 211266 articles. 19 followers. lunamoonmoon (257) is leader. Post Follow

5 Replies
672 Views

Similar Articles

[PageSpeed] 19

On 11 Mai, 08:12, "salman " <salmanabdull...@gmail.com> wrote:
> Dear Torsten,
>
> thank you very much for your kind help. i have written the code and its a=
lmost done but now only one small problem remains, here is the code that i =
wrote down;
>
> function maxwellbloch
> t=3Dlinspace(0,5,10);%the non dimensionalized characteritic time
> z=3Dlinspace(0,5,10);%the non dimensionalized characteristic length
> s=3D[1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1]; %The intitial values E(z,0) in=
cluded for ten grid points, E(2),E(3),...,E(10)
> [t,y]=3Dode45(@salman3,t,s);
> meshgrid(t,z);
> surf(t,z,E)

How should MATLAB know here what E is ?
After the call to ode45, E is hidden in y(10)-y(10+nz-1).
So write them in a two-dimensional array E where the first dimension
refers to the time step and the second dimension to the z-position.
Don't forget E(1) - it's not part of the y-vector.

> function dydt=3Dsalman3(t,y,E)

This is not the usual parameter list for the function called by ode45.
Use
function dydt=3Dsalman3(t,y)
instead.

> z=3Dlinspace(0,5,10);
> dydt=3Dzeros(size(y));
>
> y(1);y(2);y(3);y(4);y(5);y(6);y(7);y(8);y(9);y(10);y(11);y(12);y(13);y(14=
);=ADy(15);y(16);y(17);y(18);

> f=3D10; %Ten discretization points along the distance grid
> E(1)=3D0;%Boundary condition for the wave E(0,t)=3D2 supposed here;
> for j=3D10:9+f-1
> =A0 =A0 E(j-10+2)=3Dy(j);
> end
> for j=3D2:length(z)
> =A0 =A0dEdt(j)=3D-(E(j)-E(j-1))/(z(j)-z(j-1))+i*y(3);
> =A0 end
>

You don't have defined i until now - and don't use i as a variable
since it usually
refers to the imaginary unit in MATLAB (or do you mean the imaginary
unit ???)

k=3D...;
c=3D...;
 for j=3D2:length(z)
    dEdt(j)=3D-(E(j)-E(j-1))/(z(j)-z(j-1))+k/c*y(3);
 end


> %--------------------------------------------------
> k5=3D1000000000;
> k2=3D10*i*k5/2;
> k1=3Dk2/3;
> k3=3D100;
> k4=3Dk5/2;
> k6=3Dk4;
> %------------------------------------------------------
> dydt(1)=3D-k1*y(3)+k1*y(7)+k5*y(9);
> dydt(5)=3D-k2*y(6)+k2*y(8);
> dydt(9)=3Dk1*y(3)+k2*y(6)-k1*y(7)-k2*y(8)-k5*y(9);
> dydt(2)=3D-k3*y(2)-k2*y(3)+k1*y(8);
> dydt(3)=3D-k1*y(1)-k2*y(2)-k4*y(3)+k1*y(9);
> dydt(4)=3D-k3*y(4)-k1*y(6)+k2*y(7); =A0
> dydt(6)=3D-k1*y(4)-k2*y(5)+k2*y(9)-k6*y(6);
> dydt(7)=3Dk1*y(1)+k2*y(4)-k4*y(7)-k1*y(9);
> dydt(8)=3Dk1*y(2)+k2*y(5)-k6*y(8);
> for j=3D10:9+f-1
> =A0 =A0 dydt(j)=3DdEdt(j-10+2);
> end
> for m=3D2:length(z)
> =A0 =A0 dEdt(m)=3D-(E(m)-E(m-1))/(z(m)-z(m-1))+i*y(3);
> end
>
> =A0 =A0the problem is; as you mentioned to write
> for j=3D2:length(z)
> =A0 =A0dEdt(j)=3D...;
> =A0 end
>
> what should i write here? as the original equation that i wanted to solve=
 is written in the final portion of the code, like;
>
> for m=3D2:length(z)
> =A0 =A0 dEdt(m)=3D-(E(m)-E(m-1))/(z(m)-z(m-1))+i*y(3);
> end
>
> so i am confused with this, what should i declare here for dEdt(j)-...;
>
> also if i want to get plot of E(z,t) vs t and z, is the meshgrid and the =
surf command ok that i wrote above just after calling the ode45 solver?
>

I don't have the time to read the MATLAB documentation for the graphic
commands available.
But if you have stored E in a two-dimensional array like I suggested
above and you have the
times and z-positions in two seperate one-dimensional arrays, it
should be possible to combine
them in a way to get a reasonable representation of the results.

> i will highly appreciate your help.
>
> thanks alot.

Best wishes
Torsten.
0
5/11/2011 7:00:52 AM
Torsten <Torsten.Hennig@umsicht.fraunhofer.de> wrote in message <800f8ef5-9c8e-4071-8a48-b20db4d396aa@w21g2000yqm.googlegroups.com>...
> On 11 Mai, 08:12, "salman " <salmanabdull...@gmail.com> wrote:
> > Dear Torsten,
> >
> > thank you very much for your kind help. i have written the code and its almost done but now only one small problem remains, here is the code that i wrote down;
> >
> > function maxwellbloch
> > t=linspace(0,5,10);%the non dimensionalized characteritic time
> > z=linspace(0,5,10);%the non dimensionalized characteristic length
> > s=[1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1]; %The intitial values E(z,0) included for ten grid points, E(2),E(3),...,E(10)
> > [t,y]=ode45(@salman3,t,s);
> > meshgrid(t,z);
> > surf(t,z,E)
> 
> How should MATLAB know here what E is ?
> After the call to ode45, E is hidden in y(10)-y(10+nz-1).
> So write them in a two-dimensional array E where the first dimension
> refers to the time step and the second dimension to the z-position.
> Don't forget E(1) - it's not part of the y-vector.
> 
> > function dydt=salman3(t,y,E)
> 
> This is not the usual parameter list for the function called by ode45.
> Use
> function dydt=salman3(t,y)
> instead.
> 
> > z=linspace(0,5,10);
> > dydt=zeros(size(y));
> >
> > y(1);y(2);y(3);y(4);y(5);y(6);y(7);y(8);y(9);y(10);y(11);y(12);y(13);y(14);­y(15);y(16);y(17);y(18);
> 
> > f=10; %Ten discretization points along the distance grid
> > E(1)=0;%Boundary condition for the wave E(0,t)=2 supposed here;
> > for j=10:9+f-1
> >     E(j-10+2)=y(j);
> > end
> > for j=2:length(z)
> >    dEdt(j)=-(E(j)-E(j-1))/(z(j)-z(j-1))+i*y(3);
> >   end
> >
> 
> You don't have defined i until now - and don't use i as a variable
> since it usually
> refers to the imaginary unit in MATLAB (or do you mean the imaginary
> unit ???)
> 
> k=...;
> c=...;
>  for j=2:length(z)
>     dEdt(j)=-(E(j)-E(j-1))/(z(j)-z(j-1))+k/c*y(3);
>  end
> 
> 
> > %--------------------------------------------------
> > k5=1000000000;
> > k2=10*i*k5/2;
> > k1=k2/3;
> > k3=100;
> > k4=k5/2;
> > k6=k4;
> > %------------------------------------------------------
> > dydt(1)=-k1*y(3)+k1*y(7)+k5*y(9);
> > dydt(5)=-k2*y(6)+k2*y(8);
> > dydt(9)=k1*y(3)+k2*y(6)-k1*y(7)-k2*y(8)-k5*y(9);
> > dydt(2)=-k3*y(2)-k2*y(3)+k1*y(8);
> > dydt(3)=-k1*y(1)-k2*y(2)-k4*y(3)+k1*y(9);
> > dydt(4)=-k3*y(4)-k1*y(6)+k2*y(7);  
> > dydt(6)=-k1*y(4)-k2*y(5)+k2*y(9)-k6*y(6);
> > dydt(7)=k1*y(1)+k2*y(4)-k4*y(7)-k1*y(9);
> > dydt(8)=k1*y(2)+k2*y(5)-k6*y(8);
> > for j=10:9+f-1
> >     dydt(j)=dEdt(j-10+2);
> > end
> > for m=2:length(z)
> >     dEdt(m)=-(E(m)-E(m-1))/(z(m)-z(m-1))+i*y(3);
> > end
> >
> >    the problem is; as you mentioned to write
> > for j=2:length(z)
> >    dEdt(j)=...;
> >   end
> >
> > what should i write here? as the original equation that i wanted to solve is written in the final portion of the code, like;
> >
> > for m=2:length(z)
> >     dEdt(m)=-(E(m)-E(m-1))/(z(m)-z(m-1))+i*y(3);
> > end
> >
> > so i am confused with this, what should i declare here for dEdt(j)-...;
> >
> > also if i want to get plot of E(z,t) vs t and z, is the meshgrid and the surf command ok that i wrote above just after calling the ode45 solver?
> >
> 
> I don't have the time to read the MATLAB documentation for the graphic
> commands available.
> But if you have stored E in a two-dimensional array like I suggested
> above and you have the
> times and z-positions in two seperate one-dimensional arrays, it
> should be possible to combine
> them in a way to get a reasonable representation of the results.
> 
> > i will highly appreciate your help.
> >
> > thanks alot.
> 
> Best wishes
> Torsten.

Yes exactly i is the imaginary unit here. and i understaood almost all the algo that you provided, but that one step is bugging me, i can not understand it, i will be highly grateful if y ou just clarify it a little more how should i declare E here;

 for j=2:length(z)
> >    dEdt(j)=...;
> >   end, or what actually this step means?
i will do the surf and plot easily but this part is difficult for me to understand. your explanation could help me overcome my problem. 

Thank you very much Torsten,

Indebted for your help,
0
5/11/2011 7:24:02 AM
On 11 Mai, 09:24, "salman " <salmanabdull...@gmail.com> wrote:
> Torsten <Torsten.Hen...@umsicht.fraunhofer.de> wrote in message <800f8ef5=
-9c8e-4071-8a48-b20db4d39...@w21g2000yqm.googlegroups.com>...
> > On 11 Mai, 08:12, "salman " <salmanabdull...@gmail.com> wrote:
> > > Dear Torsten,
>
> > > thank you very much for your kind help. i have written the code and i=
ts almost done but now only one small problem remains, here is the code tha=
t i wrote down;
>
> > > function maxwellbloch
> > > t=3Dlinspace(0,5,10);%the non dimensionalized characteritic time
> > > z=3Dlinspace(0,5,10);%the non dimensionalized characteristic length
> > > s=3D[1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1]; %The intitial values E(z,0=
) included for ten grid points, E(2),E(3),...,E(10)
> > > [t,y]=3Dode45(@salman3,t,s);
> > > meshgrid(t,z);
> > > surf(t,z,E)
>
> > How should MATLAB know here what E is ?
> > After the call to ode45, E is hidden in y(10)-y(10+nz-1).
> > So write them in a two-dimensional array E where the first dimension
> > refers to the time step and the second dimension to the z-position.
> > Don't forget E(1) - it's not part of the y-vector.
>
> > > function dydt=3Dsalman3(t,y,E)
>
> > This is not the usual parameter list for the function called by ode45.
> > Use
> > function dydt=3Dsalman3(t,y)
> > instead.
>
> > > z=3Dlinspace(0,5,10);
> > > dydt=3Dzeros(size(y));
>
> > > y(1);y(2);y(3);y(4);y(5);y(6);y(7);y(8);y(9);y(10);y(11);y(12);y(13);=
y(14);=AD=ADy(15);y(16);y(17);y(18);
>
> > > f=3D10; %Ten discretization points along the distance grid
> > > E(1)=3D0;%Boundary condition for the wave E(0,t)=3D2 supposed here;
> > > for j=3D10:9+f-1
> > > =A0 =A0 E(j-10+2)=3Dy(j);
> > > end
> > > for j=3D2:length(z)
> > > =A0 =A0dEdt(j)=3D-(E(j)-E(j-1))/(z(j)-z(j-1))+i*y(3);
> > > =A0 end
>
> > You don't have defined i until now - and don't use i as a variable
> > since it usually
> > refers to the imaginary unit in MATLAB (or do you mean the imaginary
> > unit ???)
>
> > k=3D...;
> > c=3D...;
> > =A0for j=3D2:length(z)
> > =A0 =A0 dEdt(j)=3D-(E(j)-E(j-1))/(z(j)-z(j-1))+k/c*y(3);
> > =A0end
>
> > > %--------------------------------------------------
> > > k5=3D1000000000;
> > > k2=3D10*i*k5/2;
> > > k1=3Dk2/3;
> > > k3=3D100;
> > > k4=3Dk5/2;
> > > k6=3Dk4;
> > > %------------------------------------------------------
> > > dydt(1)=3D-k1*y(3)+k1*y(7)+k5*y(9);
> > > dydt(5)=3D-k2*y(6)+k2*y(8);
> > > dydt(9)=3Dk1*y(3)+k2*y(6)-k1*y(7)-k2*y(8)-k5*y(9);
> > > dydt(2)=3D-k3*y(2)-k2*y(3)+k1*y(8);
> > > dydt(3)=3D-k1*y(1)-k2*y(2)-k4*y(3)+k1*y(9);
> > > dydt(4)=3D-k3*y(4)-k1*y(6)+k2*y(7); =A0
> > > dydt(6)=3D-k1*y(4)-k2*y(5)+k2*y(9)-k6*y(6);
> > > dydt(7)=3Dk1*y(1)+k2*y(4)-k4*y(7)-k1*y(9);
> > > dydt(8)=3Dk1*y(2)+k2*y(5)-k6*y(8);
> > > for j=3D10:9+f-1
> > > =A0 =A0 dydt(j)=3DdEdt(j-10+2);
> > > end
> > > for m=3D2:length(z)
> > > =A0 =A0 dEdt(m)=3D-(E(m)-E(m-1))/(z(m)-z(m-1))+i*y(3);
> > > end
>
> > > =A0 =A0the problem is; as you mentioned to write
> > > for j=3D2:length(z)
> > > =A0 =A0dEdt(j)=3D...;
> > > =A0 end
>
> > > what should i write here? as the original equation that i wanted to s=
olve is written in the final portion of the code, like;
>
> > > for m=3D2:length(z)
> > > =A0 =A0 dEdt(m)=3D-(E(m)-E(m-1))/(z(m)-z(m-1))+i*y(3);
> > > end
>
> > > so i am confused with this, what should i declare here for dEdt(j)-..=
..;
>
> > > also if i want to get plot of E(z,t) vs t and z, is the meshgrid and =
the surf command ok that i wrote above just after calling the ode45 solver?
>
> > I don't have the time to read the MATLAB documentation for the graphic
> > commands available.
> > But if you have stored E in a two-dimensional array like I suggested
> > above and you have the
> > times and z-positions in two seperate one-dimensional arrays, it
> > should be possible to combine
> > them in a way to get a reasonable representation of the results.
>
> > > i will highly appreciate your help.
>
> > > thanks alot.
>
> > Best wishes
> > Torsten.
>
> Yes exactly i is the imaginary unit here. and i understaood almost all th=
e algo that you provided, but that one step is bugging me, i can not unders=
tand it, i will be highly grateful if y ou just clarify it a little more ho=
w should i declare E here;
>
> =A0for j=3D2:length(z)> > =A0 =A0dEdt(j)=3D...;
> > > =A0 end, or what actually this step means?
>
> i will do the surf and plot easily but this part is difficult for me to u=
nderstand. your explanation could help me overcome my problem.
>
> Thank you very much Torsten,
>
> Indebted for your help,- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -

I don't understand your question.
E is part of the y-vector. You recovered it from the y-vector in the
loop
 for j=3D10:9+f-1
     E(j-10+2)=3Dy(j);
 end
Now you have to supply the changes in time of E for ODE45.
The PDE reads (at least according to what you wrote)
dE/dt+dE/dz=3Di*y(3).
So in discretization point j (j>=3D2), the change of E in time (dEdt(j))
is
given by
dEdt(j)=3D-(E(j)-E(j-1))/(z(j)-z(j-1))+i*y(3).
Or did I misinterpret something ?

Best wishes
Torsten.

0
5/11/2011 9:02:30 AM
Torsten <Torsten.Hennig@umsicht.fraunhofer.de> wrote in message <17e3e245-12d1-473f-8fa8-8d94b09ba943@p13g2000yqh.googlegroups.com>...
> On 11 Mai, 09:24, "salman " <salmanabdull...@gmail.com> wrote:
> > Torsten <Torsten.Hen...@umsicht.fraunhofer.de> wrote in message <800f8ef5-9c8e-4071-8a48-b20db4d39...@w21g2000yqm.googlegroups.com>...
> > > On 11 Mai, 08:12, "salman " <salmanabdull...@gmail.com> wrote:
> > > > Dear Torsten,
> >
> > > > thank you very much for your kind help. i have written the code and its almost done but now only one small problem remains, here is the code that i wrote down;
> >
> > > > function maxwellbloch
> > > > t=linspace(0,5,10);%the non dimensionalized characteritic time
> > > > z=linspace(0,5,10);%the non dimensionalized characteristic length
> > > > s=[1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1]; %The intitial values E(z,0) included for ten grid points, E(2),E(3),...,E(10)
> > > > [t,y]=ode45(@salman3,t,s);
> > > > meshgrid(t,z);
> > > > surf(t,z,E)
> >
> > > How should MATLAB know here what E is ?
> > > After the call to ode45, E is hidden in y(10)-y(10+nz-1).
> > > So write them in a two-dimensional array E where the first dimension
> > > refers to the time step and the second dimension to the z-position.
> > > Don't forget E(1) - it's not part of the y-vector.
> >
> > > > function dydt=salman3(t,y,E)
> >
> > > This is not the usual parameter list for the function called by ode45.
> > > Use
> > > function dydt=salman3(t,y)
> > > instead.
> >
> > > > z=linspace(0,5,10);
> > > > dydt=zeros(size(y));
> >
> > > > y(1);y(2);y(3);y(4);y(5);y(6);y(7);y(8);y(9);y(10);y(11);y(12);y(13);y(14);­­y(15);y(16);y(17);y(18);
> >
> > > > f=10; %Ten discretization points along the distance grid
> > > > E(1)=0;%Boundary condition for the wave E(0,t)=2 supposed here;
> > > > for j=10:9+f-1
> > > >     E(j-10+2)=y(j);
> > > > end
> > > > for j=2:length(z)
> > > >    dEdt(j)=-(E(j)-E(j-1))/(z(j)-z(j-1))+i*y(3);
> > > >   end
> >
> > > You don't have defined i until now - and don't use i as a variable
> > > since it usually
> > > refers to the imaginary unit in MATLAB (or do you mean the imaginary
> > > unit ???)
> >
> > > k=...;
> > > c=...;
> > >  for j=2:length(z)
> > >     dEdt(j)=-(E(j)-E(j-1))/(z(j)-z(j-1))+k/c*y(3);
> > >  end
> >
> > > > %--------------------------------------------------
> > > > k5=1000000000;
> > > > k2=10*i*k5/2;
> > > > k1=k2/3;
> > > > k3=100;
> > > > k4=k5/2;
> > > > k6=k4;
> > > > %------------------------------------------------------
> > > > dydt(1)=-k1*y(3)+k1*y(7)+k5*y(9);
> > > > dydt(5)=-k2*y(6)+k2*y(8);
> > > > dydt(9)=k1*y(3)+k2*y(6)-k1*y(7)-k2*y(8)-k5*y(9);
> > > > dydt(2)=-k3*y(2)-k2*y(3)+k1*y(8);
> > > > dydt(3)=-k1*y(1)-k2*y(2)-k4*y(3)+k1*y(9);
> > > > dydt(4)=-k3*y(4)-k1*y(6)+k2*y(7);  
> > > > dydt(6)=-k1*y(4)-k2*y(5)+k2*y(9)-k6*y(6);
> > > > dydt(7)=k1*y(1)+k2*y(4)-k4*y(7)-k1*y(9);
> > > > dydt(8)=k1*y(2)+k2*y(5)-k6*y(8);
> > > > for j=10:9+f-1
> > > >     dydt(j)=dEdt(j-10+2);
> > > > end
> > > > for m=2:length(z)
> > > >     dEdt(m)=-(E(m)-E(m-1))/(z(m)-z(m-1))+i*y(3);
> > > > end
> >
> > > >    the problem is; as you mentioned to write
> > > > for j=2:length(z)
> > > >    dEdt(j)=...;
> > > >   end
> >
> > > > what should i write here? as the original equation that i wanted to solve is written in the final portion of the code, like;
> >
> > > > for m=2:length(z)
> > > >     dEdt(m)=-(E(m)-E(m-1))/(z(m)-z(m-1))+i*y(3);
> > > > end
> >
> > > > so i am confused with this, what should i declare here for dEdt(j)-...;
> >
> > > > also if i want to get plot of E(z,t) vs t and z, is the meshgrid and the surf command ok that i wrote above just after calling the ode45 solver?
> >
> > > I don't have the time to read the MATLAB documentation for the graphic
> > > commands available.
> > > But if you have stored E in a two-dimensional array like I suggested
> > > above and you have the
> > > times and z-positions in two seperate one-dimensional arrays, it
> > > should be possible to combine
> > > them in a way to get a reasonable representation of the results.
> >
> > > > i will highly appreciate your help.
> >
> > > > thanks alot.
> >
> > > Best wishes
> > > Torsten.
> >
> > Yes exactly i is the imaginary unit here. and i understaood almost all the algo that you provided, but that one step is bugging me, i can not understand it, i will be highly grateful if y ou just clarify it a little more how should i declare E here;
> >
> >  for j=2:length(z)> >    dEdt(j)=...;
> > > >   end, or what actually this step means?
> >
> > i will do the surf and plot easily but this part is difficult for me to understand. your explanation could help me overcome my problem.
> >
> > Thank you very much Torsten,
> >
> > Indebted for your help,- Zitierten Text ausblenden -
> >
> > - Zitierten Text anzeigen -
> 
> I don't understand your question.
> E is part of the y-vector. You recovered it from the y-vector in the
> loop
>  for j=10:9+f-1
>      E(j-10+2)=y(j);
>  end
> Now you have to supply the changes in time of E for ODE45.
> The PDE reads (at least according to what you wrote)
> dE/dt+dE/dz=i*y(3).
> So in discretization point j (j>=2), the change of E in time (dEdt(j))
> is
> given by
> dEdt(j)=-(E(j)-E(j-1))/(z(j)-z(j-1))+i*y(3).
> Or did I misinterpret something ?
> 
> Best wishes
> Torsten.

Yes Dear torsten,

you got it exactly right, y(1) through y(9) are initial components of the y vector. and by this statement 
 for j=10:9+f-1
>      E(j-10+2)=y(j); y(10) through y(nz) become the appended entries which are actually E(2),....,E(nz). and now the whole system of n+9 equations n for E(1),...,E(nz) and other for y(1),...,Y(9) are solved. also the main equation is declared in the end by the following statement;

dEdt(j)=-(E(j)-E(j-1))/(z(j)-z(j-1))+i*y(3);

but the only thing now thats giving bug is the following statement as you instructed me earlier is;

for j=2:length(z)
> > > >    dEdt(j)=...;
> > > >   end

i dont underdtand what should i declare here? initial conditions or boundary condiotions or what? i undertand almost all of your algorithm excpet this one point. please help me undersdtand it.

i am so much grateful for your kind help.

Thank you very much
0
5/11/2011 9:31:04 AM
On 11 Mai, 11:31, "salman " <salmanabdull...@gmail.com> wrote:
> Torsten <Torsten.Hen...@umsicht.fraunhofer.de> wrote in message <17e3e245=
-12d1-473f-8fa8-8d94b09ba...@p13g2000yqh.googlegroups.com>...
> > On 11 Mai, 09:24, "salman " <salmanabdull...@gmail.com> wrote:
> > > Torsten <Torsten.Hen...@umsicht.fraunhofer.de> wrote in message <800f=
8ef5-9c8e-4071-8a48-b20db4d39...@w21g2000yqm.googlegroups.com>...
> > > > On 11 Mai, 08:12, "salman " <salmanabdull...@gmail.com> wrote:
> > > > > Dear Torsten,
>
> > > > > thank you very much for your kind help. i have written the code a=
nd its almost done but now only one small problem remains, here is the code=
 that i wrote down;
>
> > > > > function maxwellbloch
> > > > > t=3Dlinspace(0,5,10);%the non dimensionalized characteritic time
> > > > > z=3Dlinspace(0,5,10);%the non dimensionalized characteristic leng=
th
> > > > > s=3D[1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1]; %The intitial values E=
(z,0) included for ten grid points, E(2),E(3),...,E(10)
> > > > > [t,y]=3Dode45(@salman3,t,s);
> > > > > meshgrid(t,z);
> > > > > surf(t,z,E)
>
> > > > How should MATLAB know here what E is ?
> > > > After the call to ode45, E is hidden in y(10)-y(10+nz-1).
> > > > So write them in a two-dimensional array E where the first dimensio=
n
> > > > refers to the time step and the second dimension to the z-position.
> > > > Don't forget E(1) - it's not part of the y-vector.
>
> > > > > function dydt=3Dsalman3(t,y,E)
>
> > > > This is not the usual parameter list for the function called by ode=
45.
> > > > Use
> > > > function dydt=3Dsalman3(t,y)
> > > > instead.
>
> > > > > z=3Dlinspace(0,5,10);
> > > > > dydt=3Dzeros(size(y));
>
> > > > > y(1);y(2);y(3);y(4);y(5);y(6);y(7);y(8);y(9);y(10);y(11);y(12);y(=
13);y(14);=AD=AD=ADy(15);y(16);y(17);y(18);
>
> > > > > f=3D10; %Ten discretization points along the distance grid
> > > > > E(1)=3D0;%Boundary condition for the wave E(0,t)=3D2 supposed her=
e;
> > > > > for j=3D10:9+f-1
> > > > > =A0 =A0 E(j-10+2)=3Dy(j);
> > > > > end
> > > > > for j=3D2:length(z)
> > > > > =A0 =A0dEdt(j)=3D-(E(j)-E(j-1))/(z(j)-z(j-1))+i*y(3);
> > > > > =A0 end
>
> > > > You don't have defined i until now - and don't use i as a variable
> > > > since it usually
> > > > refers to the imaginary unit in MATLAB (or do you mean the imaginar=
y
> > > > unit ???)
>
> > > > k=3D...;
> > > > c=3D...;
> > > > =A0for j=3D2:length(z)
> > > > =A0 =A0 dEdt(j)=3D-(E(j)-E(j-1))/(z(j)-z(j-1))+k/c*y(3);
> > > > =A0end
>
> > > > > %--------------------------------------------------
> > > > > k5=3D1000000000;
> > > > > k2=3D10*i*k5/2;
> > > > > k1=3Dk2/3;
> > > > > k3=3D100;
> > > > > k4=3Dk5/2;
> > > > > k6=3Dk4;
> > > > > %------------------------------------------------------
> > > > > dydt(1)=3D-k1*y(3)+k1*y(7)+k5*y(9);
> > > > > dydt(5)=3D-k2*y(6)+k2*y(8);
> > > > > dydt(9)=3Dk1*y(3)+k2*y(6)-k1*y(7)-k2*y(8)-k5*y(9);
> > > > > dydt(2)=3D-k3*y(2)-k2*y(3)+k1*y(8);
> > > > > dydt(3)=3D-k1*y(1)-k2*y(2)-k4*y(3)+k1*y(9);
> > > > > dydt(4)=3D-k3*y(4)-k1*y(6)+k2*y(7); =A0
> > > > > dydt(6)=3D-k1*y(4)-k2*y(5)+k2*y(9)-k6*y(6);
> > > > > dydt(7)=3Dk1*y(1)+k2*y(4)-k4*y(7)-k1*y(9);
> > > > > dydt(8)=3Dk1*y(2)+k2*y(5)-k6*y(8);
> > > > > for j=3D10:9+f-1
> > > > > =A0 =A0 dydt(j)=3DdEdt(j-10+2);
> > > > > end
> > > > > for m=3D2:length(z)
> > > > > =A0 =A0 dEdt(m)=3D-(E(m)-E(m-1))/(z(m)-z(m-1))+i*y(3);
> > > > > end
>
> > > > > =A0 =A0the problem is; as you mentioned to write
> > > > > for j=3D2:length(z)
> > > > > =A0 =A0dEdt(j)=3D...;
> > > > > =A0 end
>
> > > > > what should i write here? as the original equation that i wanted =
to solve is written in the final portion of the code, like;
>
> > > > > for m=3D2:length(z)
> > > > > =A0 =A0 dEdt(m)=3D-(E(m)-E(m-1))/(z(m)-z(m-1))+i*y(3);
> > > > > end
>
> > > > > so i am confused with this, what should i declare here for dEdt(j=
)-...;
>
> > > > > also if i want to get plot of E(z,t) vs t and z, is the meshgrid =
and the surf command ok that i wrote above just after calling the ode45 sol=
ver?
>
> > > > I don't have the time to read the MATLAB documentation for the grap=
hic
> > > > commands available.
> > > > But if you have stored E in a two-dimensional array like I suggeste=
d
> > > > above and you have the
> > > > times and z-positions in two seperate one-dimensional arrays, it
> > > > should be possible to combine
> > > > them in a way to get a reasonable representation of the results.
>
> > > > > i will highly appreciate your help.
>
> > > > > thanks alot.
>
> > > > Best wishes
> > > > Torsten.
>
> > > Yes exactly i is the imaginary unit here. and i understaood almost al=
l the algo that you provided, but that one step is bugging me, i can not un=
derstand it, i will be highly grateful if y ou just clarify it a little mor=
e how should i declare E here;
>
> > > =A0for j=3D2:length(z)> > =A0 =A0dEdt(j)=3D...;
> > > > > =A0 end, or what actually this step means?
>
> > > i will do the surf and plot easily but this part is difficult for me =
to understand. your explanation could help me overcome my problem.
>
> > > Thank you very much Torsten,
>
> > > Indebted for your help,- Zitierten Text ausblenden -
>
> > > - Zitierten Text anzeigen -
>
> > I don't understand your question.
> > E is part of the y-vector. You recovered it from the y-vector in the
> > loop
> > =A0for j=3D10:9+f-1
> > =A0 =A0 =A0E(j-10+2)=3Dy(j);
> > =A0end
> > Now you have to supply the changes in time of E for ODE45.
> > The PDE reads (at least according to what you wrote)
> > dE/dt+dE/dz=3Di*y(3).
> > So in discretization point j (j>=3D2), the change of E in time (dEdt(j)=
)
> > is
> > given by
> > dEdt(j)=3D-(E(j)-E(j-1))/(z(j)-z(j-1))+i*y(3).
> > Or did I misinterpret something ?
>
> > Best wishes
> > Torsten.
>
> Yes Dear torsten,
>
> you got it exactly right, y(1) through y(9) are initial components of the=
 y vector. and by this statement
> =A0for j=3D10:9+f-1
>
> > =A0 =A0 =A0E(j-10+2)=3Dy(j); y(10) through y(nz) become the appended en=
tries which are actually E(2),....,E(nz). and now the whole system of n+9 e=
quations n for E(1),...,E(nz) and other for y(1),...,Y(9) are solved. also =
the main equation is declared in the end by the following statement;
>
> dEdt(j)=3D-(E(j)-E(j-1))/(z(j)-z(j-1))+i*y(3);
>
> but the only thing now thats giving bug is the following statement as you=
 instructed me earlier is;
>
> for j=3D2:length(z)
>
> > > > > =A0 =A0dEdt(j)=3D...;
> > > > > =A0 end
>

If you have already included
for j=3D10:9+f-1
dEdt(j)=3D-(E(j)-E(j-1))/(z(j)-z(j-1))+i*y(3);
end
in your code, the section
for j=3D2:length(z)
dEdt(j)=3D...;
end
is superfluos.

> i dont underdtand what should i declare here? initial conditions or bound=
ary condiotions or what? i undertand almost all of your algorithm excpet th=
is one point. please help me undersdtand it.
>
> i am so much grateful for your kind help.
>
> Thank you very much- Zitierten Text ausblenden -
>
> - Zitierten Text anzeigen -

Best wishes
Torsten.
0
5/11/2011 10:29:39 AM
Reply:

Similar Artilces:

Please help. ODE in space domain. should i use FDTD or simple integration? please help
Dear friends, i have an equation, dF(z,t)/dz=cos(A(z))*F(z,t)+sin(A(z))*B*(2n_1-n_2-t); F is a function that needs to be plotted for space and time. A is a known function of z. n_1 and n_2 are time instants whic are known. in order to implement this using FDTD, how can i do it? alternatively, for 20 time points; i use ode solver for each value of time and for all values of z and get plot of F(z,t). but the main problem is this F(z,t) term on both the LHS and RHS of the equation. how do i handle this one? any help is greatly appreciated. thanks alot "salman " <salmanabdullah9@gmail.com> wrote in message <iu9g9o$50d$1@newscl01ah.mathworks.com>... > Dear friends, > > i have an equation, > > dF(z,t)/dz=cos(A(z))*F(z,t)+sin(A(z))*B*(2n_1-n_2-t); > > F is a function that needs to be plotted for space and time. A is a known function of z. n_1 and n_2 are time instants whic are known. in order to implement this using FDTD, how can i do it? alternatively, for 20 time points; i use ode solver for each value of time and for all values of z and get plot of F(z,t). but the main problem is this F(z,t) term on both the LHS and RHS of the equation. how do i handle this one? > > any help is greatly appreciated. > > thanks alot "salman " <salmanabdullah9@gmail.com> wrote in message <iub72s$eoq$1@newscl01ah.mathworks.com>... > "salman " <salmanabdullah9@gmail.com> wrote in message <iu9...

an ODE problem. please do help please.
dear friends, i have these two coupled equations dydt(1)=y(1)*f+y(2)*k1; dydt(2)=k2*y(2)+k3*y(1); but here f is actually f(t)=cos(t). and t=0:100; how can i incorporate another time dependant function into this coupled system? please help on this one. i am really stuck here please help. thanks "salman " <salmanabdullah9@gmail.com> wrote in message news:iuhu66$hn1$1@newscl01ah.mathworks.com... > dear friends, > > i have these two coupled equations > > dydt(1)=y(1)*f+y(2)*k1; > dydt(2)=k2*y(2)+k3*y(1); > > but here f is actually f(t)=cos(t). and t=0:100; > > how can i incorporate another time dependant function into this coupled > system? > > please help on this one. i am really stuck here please help. Remember that for the ODE solvers the function that you specify (the right-hand side) must be a function of t and y. function dydt = myequations(t, y) k1 = 1; k2 = 2; k3 = 3; dydt = [y(1)*f(t) + y(2)*k1; k2*y(2) + k3*y(1)]; where f is: function z = f(t) z = cos(t); If you don't want to hard-code f, you could use the techniques described in the help for passing additional inputs to the ODE function. function dydt = myequations(t, y, myOtherFunction) k1 = 1; k2 = 2; k3 = 3; dydt = [y(1)*myOtherFunction(t) + y(2)*k1; k2*y(2) + k3*y(1)]; and use this as: [t, y] = ode45(@(t, y) myequations(t, y, @cos), ... -- Steve Lord slord@mathworks.com To contact Technical Support use the Contact Us link on ...

Final step, using the output of ode45 in another equation. please help!!!
Dear Torsten, i am almost done with the problem. now the last step is; i want to plot the function E as function of z and t. however since if after calling ode45(@salman3,t,s); if i write surf(t,z,E); it will not work i guess because MATALAB does not know what is E. now how will i plot E? in this line; E(1)=0;%Boundary condition for the wave E(0,t)=0 supposed here; for j=10:9+f-1 E(j-10+2)=y(j); end E(1) is declared separate and E(2) through E(10) (discretization points 10 in my case) are the part of y vector. now how shall i combine all these values to get the plot of E? i mean in my previous problem i had to plot y(3) so i just wrote; plot(t,y(:,3)) now here since dydt(10) through dydt(18) are all the values of dEdt, so how should i plot E(z,t); for your reference i am pasting my code below; function maxwellbloch t=linspace(0,5,10); z=linspace(0,5,10); s=[1,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1]; %The intitial values E(z,0) included for ten grid points, E(2),E(3),...,E(10) [t,y]=ode45(@salman3,t,s); meshgrid(t,z); surf(t,z,E) %but this will not work i think. function dydt=salman3(t,y) z=linspace(0,5,10); dydt=zeros(size(y)); y(1);y(2);y(3);y(4);y(5);y(6);y(7);y(8);y(9); f=10; %Ten discretization points along the distance grid E(1)=0; %Boundary condition for the wave E(0,t)=0 supposed here; for j=10:9+f-1 E(j-10+2)=y(j); end for m=2:length(z) dEdt(m)=-(E(m)-E(m-1))/(z(m)-z(m-1))+i*y(3); end %-------------------------...

PLease help. FDTD or simple integration problem. please help
Dear friends, i have an equation, dF(z,t)/dz=cos(A(z))*F(z,t)+sin(A(z))*B*(2n_1-n_2-t); F is a function that needs to be plotted for space and time. A is a known function of z. n_1 and n_2 are time instants whic are known. in order to implement this using FDTD, how can i do it? alternatively, for 20 time points; i use ode solver for each value of time and for all values of z and get plot of F(z,t). but the main problem is this F(z,t) term on both the LHS and RHS of the equation. how do i handle this one? any help is greatly appreciated. thanks alot ...

consider I have simple calculator GUI.. how do I export each answer to excel in MATLAB? please help me..i already used xlswrite but it will just replace the answer in excel.. can you help me a c
Code example: a = get(handles.input1_gamma,'String'); %gamma b = get(handles.input2_h,'String'); %h c = get(handles.input3_q,'String'); %q d = get(handles.input4_power,'String'); %POWER % a and b are variables of Strings type, and need to be converted % to variables of Number type before they can be added together out = [str2num(a) * str2num(b)* str2num(c)]; e = {'Power','gamma','H','Q'; out,str2num(a),str2num(b),str2num(c)}; xlswrite('results.xls', e, 'Sheet1' , 'A1'); ...

Please help, Problem using vector,
Could someone please advise me what I�m doing wrong. I�m trying to use vector in a simple program. I'm using this command to compile gxx -Wall -o vectorTest.exe vectorTest.cpp But I get these errors: >>>>>>>>>>>>>>>>>>>>>>>>>>>> error <<<<<< vectorTest.cpp: In function `int main()': vectorTest.cpp:11: error: `vector' undeclared (first use this function) vectorTest.cpp:11: error: (Each undeclared identifier is reported only once for each function it appears in.) vectorTest.cpp:11: error: parse error before `(' token >>>>>>>>>>>>>>>>>>error <<<<<<<<<<<<<<<<<<<<<<<<< Here is the relevant part of the code, the error happens on the line I noted with **** >>>>> snip <<<<<<<<<< #include <iostream> #include <vector> using namespace std; int main() { int val[10] = {1,2,2,2,2,4,7,8,9,6}; int saveVal; vector v1(val, val+10); // **** This is where the error starts >>>>> snip <<<<<<<<<< Thank you so much in advance -- leila <gcceducate@tutorialwizard.net> wrote: > #include <iostream> > #include <vector> > using namespace std; > int main() > { > int val[10] = {1,2,2...

Too many output arguments,Error using ODE solver. please help
Dear friends, i get an error ??? Error using ==> photonechofdtd>echo Too many output arguments. function photonechofdtd tau=0:29; zee=0:29; f=30; L=30;%Length of the medium alpha=1;% Absorption coefficient s=[.4,.6,0,0]; for h=2:f s(4+5*(h-2)+1)=1-.6*exp(-zee(h)); s(4+5*(h-2)+2)=.6*exp(-zee(h)); s(4+5*(h-2)+3)=0; s(4+5*(h-2)+4)=0; end [T,Y]=ode15s(@(t,y)echo(t,y),tau,s);<--------------Here it gives error. for w=1:numel(T) echo_i(w,1)=0; for h=2:f echo_i(w,h)=Y(w,4+5*(h-2)+2).*exp(Y(w,4+5*(h-2)+2)-Y(w,4+5*(h-2)+1)).*(L-zee(h)); end end size(echo_i) size(tau) size(g) function echo(tau,y) omega=5000000; f=0:29; zee=0:29; y1(1) = y(1); y2(1) = y(2); y3(1) = y(3); y4(1) = y(4); for h=2:f y1(h) = y(4+5*(h-2)+1); y2(h) = y(4+5*(h-2)+2); y3(h) = y(4+5*(h-2)+3); y4(h) = y(4+5*(h-2)+4); end dydt =zeros(numel(y),1); dy1dt=zeros(numel(zee),1); dy2dt=zeros(numel(zee),1); dy3dt=zeros(numel(zee),1); dy4dt=zeros(numel(zee),1); for h=1:f dy1dt(h)=-(i/2)*omega*(y3(h)-y4(h)); dy2dt(h)=(i/2)*omega*(y3(h)-y4(h)); dy3dt(h)=-(i/2)*omega*(y1(h)-y2(h)); dy4dt(h)=(i/2)*omega*(y1(h)-y2(h)); end dydt(1) = dy1dt(1); dydt(2) = dy2dt(1); dydt(3) = dy3dt(1); dydt(4) = dy4dt(1); for h = 2: f dydt(4+5*(h-2)+1) = dy1dt(h); dydt(4+5*(h-2)+2) = dy2dt(h); dydt(4+5*(h-2)+3) = dy3dt(h); dydt(4+5*(h-2)+4) = dy4dt(h); end Dear friends, the error is only in a line, but i pasted my code so that you may look easily. Thanks, Waiting for...

please help, a little problem in MATLAB
Dear friends, i have a program in MATLAB, that requires me to run it again and again by changing different parameters. is it possible that i may not have to run the program again and again and just write the plot command in the command window (rather than calling the m file again and again)? rephrasing my question, if in my code i have to extract various vectors from this vector Y(:,:,:), is it possible that when i call the m file once and then aftewards i store the matrix Y(:,:,:) data somehow and then giving the plot command in just the command window (without calling the m file again) and change the parameters to see the new result? i think i made it clear. i will wait for your help. Thanks alot On Sep 10, 11:40=A0am, "salman " <salmanabdull...@gmail.com> wrote: > Dear friends, > > i have a program in MATLAB, that requires me to run it again and again by= changing different parameters. is it possible that i may not have to run t= he program again and again and just write the plot command in the command w= indow (rather than calling the m file again and again)? rephrasing my quest= ion, if in my code i have to extract various vectors from this vector Y(:,:= ,:), is it possible that when i call the m file once and then aftewards i s= tore the matrix Y(:,:,:) data somehow and then giving the plot command in j= ust the command window (without calling the m file again) and change the pa= rameters to see the new result? > > i think i...

ODE solver problem...please help !!!!
Hi everyone! I'm new to Matlab and currently trying to solve an ODE system...and something is not working because I'm having a NaN solution vector. Here's my main test.m file: %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% initial values vector: y0=zeros(5,1); y0(1) = 0; y0(2) = 0; y0(3)= 33.3; y0(4)= 8.307; %Plage de temps de simulation tspan=[0,10000]; %Appel du solveur d'équations différentielles (ODE) [T,Y] = ode15s(@equation_test, tspan, y0); %I tried ode45, ode23s and ode114.. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% And the equation_test.m file containing my differential equations : function dydt=equation_test(t,y) dydt=zeros(5,1); k1=0.003;k_1=0.06; k2=0.01;k_2=0.1; k3=1;k_3=0.01; Vmax4=450;Km4=50; v1=k1*y(3)*y(4)-k_1*y(1); v2=k2*y(1)*y(1)-k_2*y(2); v3=k3*y(2)-k_3*y(5); v4=Vmax4*(y(5)/(Km4*y(5))); %%%% The problem is probably here..0/0 giving NAN %%%% but how can I fix this if y(5) has to equal to %%%% 0 for the first iteration ??? dydt(1)=v1-(2*v2); dydt(2)=v2+v3-v4; dydt(3)=-v1; dydt(4)=-v1; dydt(5)=-v1; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Thanks for your help ! "Genevieve " <genevieve_mass02@hotmail.com> wrote in message <iavg8n$rev$1@fred.mathworks.com>... > v4=Vmax4*(y(5)/(Km4*y(5))); %%%% The problem is probably here..0/0 giving NAN > ...

please help me. a small error in ODE routine
FRIENDS, here is a portion of my code. in the * line (3rd last line) there is an error in interp1 call. as i think, i have inserted every thing correctly but it gives error. i can not understand it. please help me ion this. thanks alot t=0:.00001:.0001; s=[1,0,0,0]; e=[1,0]; r=0:.00001:.0001; r1=0:.00001:.0001; k_r=r; t1=0:.00001:.0001; dd=(t(end)-t(1))/length(t); k=1*pi/(10.95*.000003); td1=.000003; td2=td1+.0000064; k2=10*pi/(.00002);% this Rabi frequency in combination with the Pulse duration gives the pi pulse area tr1=.000043; tr2=tr1+.000008; zeros1d=td1/dd; zeros1d=round(zeros1d) onesd=(td2-td1)/dd; onesd=round(onesd) zeros2d=(.0001-td2)/dd; zeros2d=round(zeros2d) zeros1r=tr1/dd; zeros1r=round(zeros1r) onesr=(tr2-tr1)/dd; onesr=ceil(onesr) zeros2r=(.0001-tr2)/dd; zeros2r=round(zeros2r) k_d=k*[zeros(1,zeros1d),.8470*ones(1,onesd),zeros(1,zeros2d)]; k_r=k2*[zeros(1,zeros1r),.25090*ones(1,onesr),zeros(1,zeros2r)];% pi sca size(k_d) size(k_r) k_c=k_d+k_r; a=340000; x=linspace(-2*a,2*a,161); del=(1/(sqrt(pi)*a))*exp(-.5*(x./a).^2); del=del/sum(del); for u=1:length(del) [T,Y]=ode23s(@(t,y)system1(t,y,x(u),t1,k_c),t,s); Y_c3(:,:,u)=Y(:,:); end save Y_c3 for d=1:length(t) final1(d)=sum(real(Y_c3(d,1,:))); end for j=1:length(t) final2(j)=sum(real(Y_c3(j,2,:))); end for k=1:length(final2) [R,A]=ode45(@(r,a)second(r,a,final2(k),r1,k_r),r,e); P(:,:,k)=a(:,:); end save P; function dydt=system1(t,y,del,t1,k_c)...

Please Please...image help
Hi, im trying to figure out how to save a matrix(image) without losing any information of the matrix. Lets me explain myself: If i have a matriz like this: f=127*ones(20,20); And then i show it imshow(f) Its a white square.....this is incorrect because if: 0 = white 255=black then 127 = grey!!!! Now if we do this: imshow(f,[0 255]) It shows the grey square because we have specified exactly the range of grayscale... THE PROBLEM IS: I can save the image because it always happen the same thing that occur in our first case, i mean, we lose the information and it will save a white square!!! I beg you fellas, if anyone knows how to save the matrix as an image(imwrite) how to do it without losing the info. THANKS "Dave" <kohonen@hotmail.com> wrote in news:2245807.1140198806730.JavaMail.jakarta@nitrogen.mathforum.org... > Hi, im trying to figure out how to save a matrix(image) without losing any information of the matrix. [...] > f=127*ones(20,20); It looks like your f image is an indexed image. The color depend of the colormap. Look at the imwrite documentation. > imshow(f) > Its a white square.....this is incorrect because if: imwrite(f,'f.bmp','bmp'); produce also a white square. [...]> imshow(f,[0 255]) > It shows the grey square because we have specified exactly the range of grayscale... > m=[0:255]'*[1 1 1]/255; % 256 length gray scale imwrite(f,m,'fm.bmp'); produce a middle gray s...

URGENT PLEASE HELP ! HELP !
I am configuring ADSL connection on FC 2 : [root@localhost sbin]# /sbin/ifup ppp0 /sbin/adsl-start: line 215: 2852 Terminated $CONNECT "$@" >/dev/null 2>&1 [root@localhost sbin]# /sbin/ifup ppp0 [root@localhost sbin]# ping 192.168.1.1 connect: Network is unreachable [root@localhost sbin]# /sbin/adsl-status /etc/sysconfig/network-scripts/ifcfg-ppp0 adsl-status:Link is down (can't read pppoe PID file /var/run/pppoe-adsl.pid.pppoe) [root@localhost sbin]# vi /var/run/pppoe-adsl.pid.pppoe [root@localhost sbin]# vi /var/run/ [root@localhost sbin]# cd /var/run/ [root@localhost run]# ls acpid.socket dbus klogd.pid named ptal-mlcd sendmail.pid usb atd.pid dovecot mdadm.pid netreport ptal-printd sm-client.pid utmp console dovecot-login mdmpd news pvm3 sshd.pid xfs.pid console.lock gdm.pid messagebus.pid ppp rpc.statd.pid sudo xinetd.pid crond.pid gpm.pid mysqld pppd.tdb saslauthd syslogd.pid //// no pppoe-adsl.pid.pppoe file ????????????????????? [root@localhost run]# cd ppp [root@localhost ppp]# ls /// nothing here too ?????????? [root@localhost ppp]# What should I do ?? I am trying to configure net on linux for last 15 days ...Please Help me Urgent ?? What is the problem ?? If u need any more information I will provide but please help me onkar wrote: [putolin] > If u need any more information I will provide but please help me Don't mu...

Please help with this equation, FDTD or simple integration problem
Dear Friends, Hi, i am having a problem. i have an equation; dA(z,t)/dz=-a/2)*cos(B(z))*A(z,t)+a*sin(C(z))*F*(2t1-t2-t); here B, C are function of z only, while A is function of z and t. others are constant. how may i plot this? just with using some ode solver? this function should give me the result of A as function of space and time. will some FDTD method be used here? thanks alot for help. "salman " <salmanabdullah9@gmail.com> wrote in message <iu6p5k$9p2$1@newscl01ah.mathworks.com>... > Dear Friends, > > Hi, i am having a problem. i have an equation; > > dA(z,t)/dz=-a/2)*cos(B(z))*A(z,t)+a*sin(C(z))*F*(2t1-t2-t); > > here B, C are function of z only, while A is function of z and t. others are constant. how may i plot this? just with using some ode solver? this function should give me the result of A as function of space and time. will some FDTD method be used here? > > thanks alot for help. - - - - - - - - - - - - You can regard this as an ordinary differential equation in z, with t being held fixed. For each possible value of t, if you have an initial condition for A(z,t) at some z, this differential equation can be solved over the desired range of z while holding t at that fixed value. I think it would be rather tedious carrying out such a process with numerous different t values using one of the 'ode' solvers, though that remains as a distinct possibility. In a sense this can also be regarded as...

Adding a vector to the advection equation RHS. please help.
Dear friends, i have a system, dE/dz+k*dE/dt=k*y(3); here y(3) is a vector. i am trying it using other methods also but one way to do it would be through the advection equation. however the standard advection equation has often a zero or a constant term on the RHS, while i have a vector quantity on the RHS. any idea or suggestion how to add the vector term to the RHS of the advection equation in each iteration? thanks alot On 5/15/2011 8:19 PM, salman wrote: > Dear friends, > > i have a system, dE/dz+k*dE/dt=k*y(3); here y(3) is a vector. i am trying it > using other methods also but one way to do it would be through the advection equation. > however the standard advection equation has often a zero or a constant term on the RHS, > while i have a vector quantity on the RHS. > > any idea or suggestion how to add the vector term to the RHS of the advection > equation in each iteration? > thanks alot It looks like you have a set of N pde's, which each can be solved on its own. Using the i'th entry in the vector y for the i'th pde. So, now you have N pde's, each has a scalar in the RHS. Not a vector. Solve them one by one, in a loop. --Nasser On May 16, 3:19=A0pm, "salman " <salmanabdull...@gmail.com> wrote: > Dear friends, > > i have a system, dE/dz+k*dE/dt=3Dk*y(3); here y(3) is a vector. i am tryi= ng it using other methods also but one way to do it would be through the ad= vection equation. h...

problem with check if number is integer in matlab? help please
Hi, I have a big problems in matlab, with checking if number is integer. Part of code from my function: cijeli=zeros(size(rjesenje,1),1); for i=1:size(rjesenje,1) if mod(rjesenje(i,1),1)==0 cijeli(i,1)=1; end end When I list vector rjesenje, it shows: 1.0000 1.0000 3.0000 2.0000 1.0000 but cijeli is (after loop): 0 1 1 1 1 It shoulkd be : 1 1 1 1 1 (in vert) What's hapenning here? When I try this: mod(rjesenje(1,1),1) it shows me 1.000 but rjesenje(1,1) is 1.000 ???? Can anybody help me? Is there some mark which matlab sets to the begin of vector, so that is problem? Thanks in advance, Amer On 5/27/2011 5:04 PM, Amer wrote: .... > I have a big problems in matlab, with checking if number is integer. > Part of code from my function: > > cijeli=zeros(size(rjesenje,1),1); > > for i=1:size(rjesenje,1) > if mod(rjesenje(i,1),1)==0 cijeli(i,1)=1; > end > end > > When I list vector rjesenje, it shows: > > 1.0000 > 1.0000 > 3.0000 > 2.0000 > 1.0000 .... try format long and then look at the result of rjesenje; I think you'll begin to get the idea of what the matter is... > Can anybody help me? This is a typical problem w/ floating point representation when a nearly integer value is obtained by some other operation than actually entering an integer. The internal representation isn't _quite_ exactly 1 in this case but very close. See the FAQ at <http://matlabwiki.mathworks.co...

please help me. (using two ode solvers in one routine)
Dear Friends, i need your help in a following problem. my final target is to get a profile of a quantity YY(x,t) whic is connected with 2 ode solvers in a specific way. please have a look at this short code, this will make it clear what i want to do. for m=1:length(del) [T,Y]=ode45(@(t,y)system(t,y,del(m),t1,k1,t2,k2),t,s)%k1 and k2 are time dependent quantities Y1(:,:,m)=Y(:,:) end for m=1:length(del) YY(m)=sum(real(Y1(m,1,:))) end for g=1:length(del) YYY(g)=sum(real(Y1(m,2,:))) end function system(t,y,t1,k1,t2,k2) k1=interp1(t1,k1,t); k2=interp1(t2,k2,t); dydt(1)=k1*y(1)+del*y(2); dydt(2)=k2*y(2)+del*y(1); %--------------------------------------------% now these quantites YY and YYY are used in the following differential equations wrt. x as following; dydx(1)=-exp(-x)*YY(1);% these equations have to be solved in x for every tvalue of time dydx(2)=exp(-x)*YYY(1); and i want now to solve these two equations in space for every value of time in previous coupled equations. is this approach correct? please tell me friends how can i do this? thanks "salman " <salmanabdullah9@gmail.com> wrote in message <jp73ci$5t2$1@newscl01ah.mathworks.com>... > Dear Friends, > > i need your help in a following problem. my final target is to get a profile of a quantity YY(x,t) whic is connected with 2 ode solvers in a specific way. please have a look at this short code, this will make it clear what i want to do. > > for...

Problem INSERTing date into mySQL using VB, please help!!
I have tried everything and I can't see what the problem is this is my code: Set cafeRevenue = New revenue currentDate = CDate(lblDate.Caption) cafeRevenue.dateOfRevenue = currentDate cafeRevenue.Category = "Cafe" cafeRevenue.Cost = cafeCost connection rdoInsertRevenvue (cafeRevenue) 'this calls the method Public Function rdoInsertRevenvue(ByVal revenue) With rdoQry .name = "NewSession" .SQL = "INSERT INTO revenue VALUES('" & Format(revenue.dateOfRevenue, "YYYY-MM-DD") & "','" & revenue.Category & "','" & revenue.Cost & "')" .RowsetSize = 1 Set .ActiveConnection = cnMySql Set rdoRS = .OpenResultset(rdOpenKeyset, rdConcurRowVer) End With End Function Its getting the right date in this method and I debug the Format and that comes out with the right date YYYY-MM-DD but something happens between this and the database!! Did i leave out a ' or something?? Please help!! Have tried everything!!!! Im using mySQL as a database Please help! Thank you! Charly wrote: [snip] > Its getting the right date in this method and I debug the Format and > that comes out with the right date YYYY-MM-DD but something happens > between this and the database!! Did i leave out a ' or something?? > Please help!! Have tried everything!!!! Im using mySQL as a database > Please help! > Thank you!...

Please Help with This Problem
For some reason when I download a pdf document instead of having adobe acrobat read it, notepad opens it and it is all garbled, how do i reset it back to adobe, thanks for your time jcbond99@hotmail.com (Gordon Gekko IDCC on the Nasdaq) wrote in message news:<9ad59d73.0405011531.182ef41b@posting.google.com>... > For some reason when I download a pdf document instead of having adobe > acrobat read it, notepad opens it and it is all garbled, how do i > reset it back to adobe, thanks for your time Best option is probably to download the latest verion of Acrobat Reader and re-install it. Sujit D'Mello "Gordon Gekko IDCC on the Nasdaq" <jcbond99@hotmail.com> wrote in message news:9ad59d73.0405011531.182ef41b@posting.google.com... > For some reason when I download a pdf document instead of having adobe > acrobat read it, notepad opens it and it is all garbled, how do i > reset it back to adobe, thanks for your time Maybe the filetype-association has changed. You could also try to reset is manually : start-menu, settings, control panel, folder options, file types. There you search the pdf-extension and change the program to use when opening such a file to Acrobat Reader (you'll have to browse through your programs folder to do that). "> Maybe the filetype-association has changed. You could also try to reset is > manually : start-menu, settings, control panel, folder options, file types. > There you search the pdf...

Please help new to laptops... Help
Hi all, Just bought an Evesham A410 Voyager which comes with the AMD Turion MT34 cpu and the ATI mobile X700 graphics card. I would like to play the occasional game of Counter Strike Source when I'm working away but have found it jumpy when I've played. I've checked all settings etc and the system hould be up to a game - I'm guessing its the 512mb of ram. I'm new to laptops etc and need some advice on ram - Do they use pc3200 ddr (SODimm)? Is my notebook capable of running dual channel? what ram do I buy? Thanks in advance. An excellent place to purchase ram is from Crucial. Go to their website, enter your make and model and it will tell you which and how much ram your computer will be able to use. www.crucial.com -- Don Vancouver, USA "Chris-John Turner" <sacrum@clara.co.uk> wrote in message news:1122821279.3182.0@lotis.uk.clara.net... > Hi all, > > Just bought an Evesham A410 Voyager which comes with the AMD Turion MT34 > cpu > and the ATI mobile X700 graphics card. I would like to play the > occasional > game of Counter Strike Source when I'm working away but have found it > jumpy > when I've played. I've checked all settings etc and the system hould be > up > to a game - I'm guessing its the 512mb of ram. I'm new to laptops etc and > need some advice on ram - Do they use pc3200 ddr (SODimm)? Is my notebook > capable of running dual channel? what ram...

Undefine index, please help... please :(
HI, I installed php4 for apached and restart apache afterward. but my little php script generated error followint error: PHP Notice: Undefined index: myname in /usr/local/www/data-dist/www.authtec.com/php-test.php on line 2 I was trying to run the following php script in apache: <?php if($_POST["myname"]) { print "Hello, ".$_POST["myname"]."<p>\n" .nl2br($_POST["textbox"]); } else { ?> <form method="post" action="php-test.php"> <input type=input type=text name=myname> <textarea cols=20 rows=4 wrap=virtual name=textbox></textarea> <input type=submit value="Submit"> </form> <?php } ?> What could be wrong with my configuration? and how can I fix it? Thanks Sam sam wrote: <snip> > <?php > if($_POST["myname"]) { > print "Hello, ".$_POST["myname"]."<p>\n" > .nl2br($_POST["textbox"]); > } else { <snip> You are getting a notice, not an error. Do this instead: if(isset($_POST["myname"])) and your notice will be gone. Sam, You should _always_ make sure a key exists in an array before using it. <?php if (array_key_exists('myname', $_POST) ) { echo "<p>Hello, ", $_POST['myname'], "</p>"; } ?> I also would s...

PLEASE PLEASE HELP
I am a newbie to Castor. I downloaded all the jar files, made changes to the classpath etc, but I keep on getting exceptions being thrown. The XML schema file is as follows: <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="catalog"> <xsd:complexType> <xsd:sequence> <xsd:element name="book" minOccurs="0" maxOccurs="unbounded"> <xsd:complexType> <xsd:sequence> <xsd:element name="author" type="xsd:string"/> <xsd:element name="title" type="xsd:string"/> <xsd:element name="genre" type="xsd:string"/> <xsd:element name="price" type="xsd:float"/> <xsd:element name="publish_date" type="xsd:date"/> <xsd:element name="description" type="xsd:string"/> </xsd:sequence> <xsd:attribute name="id" type="xsd:string"/> </xsd:complexType> </xsd:element> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> If I type in: C:\>java org.exolab.castor.builder.SourceGenerator -i C:\\Temp\\Test.xsd I get the error message: Exception in thread "main" java.lang.I...

i want help to find this Equations in matlab Quickly for my research (statistics about image) and the Answer im my mail Please
how i foud this Equation to To find inf about image and how How to apply those equations in matlab 1-mean2 avarage 2-std2 standard deviation 3-corr2 correlation 4-entropy 5-length 6-RMSE 7-SNR 8-PSN "ahmed abad" <princeofpop46@googlemail.com> wrote in message <h4n8pe$rvv$1@fred.mathworks.com>... > how i foud this Equation to To find inf about image and how How to apply those equations in matlab > 1-mean2 avarage > 2-std2 standard deviation > 3-corr2 correlation > 4-entropy > 5-length > 6-RMSE > 7-SNR > 8-PSN ...

Re: please help: overflow problem in query result using double precision fields from underlying table
Hi all, I think it might be my original database table after all that caused the problem. Unlike I said below, I pasted the columns containing the data from my original database into a new table and I kept having the problem. I just tried to actually fill the new table with fresh data and now I can run the query smoothly. Thanks for the help, I think I have to check on the integrity of the data in the original table. Maarten "Maarten van der Cammen" <maartenvandercammen@yahoo.com> wrote in message news:... > Hi Barry, > > When I switch to the SQL view of my query, this is what I have: > > SELECT TableTest.testID, [FieldA]/[FieldB] AS divided > FROM TableTest > WHERE ((([FieldA]/[FieldB])>0.5)); > > In the query view it look like: > > > > When I run the query, after two time "Overflow" message I get: > > > > > Also I started a new database, filled in some data to find out whether the > database I work with might contain some corrupt data or something, but I > kept having the same problem. > It might be that it is just not possible with double precision data in > Access to perform such actions, but to me that sounds pretty weird. > > Thanks for the help. > > Maarten > > > > > "Barry Edmund Wright" <bwright_msaccess@sympatico.ca> wrote in message > news:1181437818.310656.292570@p47g2000hsd.googlegroups.com... >> On Jun...

I want to output an arbitrary waveform using LabView onto the oscilliscope through the DAQ2005 card. Can anyone help please?
Hey guys, &nbsp; I am new to LabView and my final year project depends on it! Please help as much as you can! &nbsp; I am trying to&nbsp;output an arbitrary waveform on an oscilliscope. The shape of the waveform&nbsp;depends on user input parameters like no. of samples, amplitude of each sample and the&nbsp;frequency of desired waveform. Please refer to attached Arbitrary_Wave_Display.vi. In the attached vi, the desired waveform is displayed on the front panel. My project requires that I output this waveform through the analogue output channels of the 2 DAQ2005 cards that I have. When I connect the output of th Arbitrary_Wave.vi to the input of the AO write express vi, there is no output of the oscilliscope. I believe it should be connection problems with regards to while loops and loop conditions. I have also attached my attempted vi. &nbsp; Please feel free to give some advice. It is greatly appreciated, &nbsp; Best regards, TheApprentice of LabView &nbsp; &nbsp; ...

Web resources about - Please help. just last small problem in using the vector output from ODE in another equation. please help - comp.soft-sys.matlab

Equation - Wikipedia, the free encyclopedia
In mathematics , an equation is a formula of the form A = B , where A and B are expressions that may contain one or several variables called ...

Romania's footballers choose equations over numbers on jerseys
Romanian national soccer team players replace their shirt numbers with equations to promote learning.

Romania's footballers choose equations over numbers on jerseys
Romanian national soccer team players replace their shirt numbers with equations to promote learning.

Has Australian dating culture gone backwards as equality changes the equation?
Urgency has been removed from the romantic world. We used to have to arrive on time to dates because there was no way of easily communicating ...

An equation that debunks conspiracy theories
... Grimes decided to try to create a mathematical measure for just how stupidly implausible that idea is—a sort of conspiracy probability equation. ...

Joe Biden and the Cold Equations
Looking at @FoxNews @BillKristol & @WSJ takes on Biden non-run, gotta wonder: Was it all an elaborate practical joke at GOP media's expense? ...

Community is king: a simple equation
... has been for some time. But what is community? Community, from the perspective of marketing and especially social media marketing, is an equation: ...

How to solve the STEM gender equality equation
It's common knowledge that women are underrepresented in STEM careers. What's less clear is what businesses can do to better attract and retain ...

Math whizzes recalculate beer-foaming equation
Just in time for St. Patty's, mathematicians from Ireland figure out how to put a better, cheaper head on your Guinness.

The Surprise Equation: Low Carb + Gluten-Free = Better Bread
Next time you dine out at a restaurant that serves a free breadbasket, watch the people around you. You’ll see some of your fellow diners eye ...

Resources last updated: 3/30/2016 7:48:07 PM