I am required to use Matlab to write a code to calcuate a value from guessing its initial value, i.e. using iteration method to obtain a value.
I am new to Matlab, hence I have no idea how to write such code. Could anyone give me some advice for it? I also have outlined my problem as follows,
1. evaluate T1 and T2 from a set of equations from its initial guessed value
2. Using initial guessed value of T1 and T2, and go though a set of equation, obtained a new value of T1 and T2
3. subsitute these new T1 and T2, back to the set of equation from begining
4. Carry out this iterative process untill the T1 and T2 are converged into constant values
I will be much appreciated if my problem can be answered
best regards
Jun
|
|
0
|
|
|
|
Reply
|
Jun
|
2/28/2011 11:41:29 AM |
|
On Feb 28, 6:41=A0am, "Jun Yi " <goodhandsomeh...@hotmail.com> wrote:
> I am required to use Matlab to write a code to calcuate a value from gues=
sing its initial value, i.e. using iteration method to obtain a value.
>
> I am new to Matlab, hence I have no idea how to write such code. Could an=
yone give me some advice for it? I also have outlined my problem as follows=
,
>
> 1. evaluate T1 and T2 from a set of equations from its initial guessed va=
lue
> 2. Using initial guessed value of T1 and T2, and go though a set of equat=
ion, obtained a new value of T1 and T2
> 3. subsitute these new T1 and T2, back to the set of equation from begini=
ng
> 4. Carry out this iterative process untill the T1 and T2 are converged in=
to constant values
>
> I will be much appreciated if my problem can be answered
>
> best regards
> Jun
-------------------------------
Something like this maybe
[t1old t2old] =3D guess_values();
tolerance =3D 0.000001; % Whatever you want.
while delta1 < tolerance && delta2 < tolerance
[t1 t2] =3D guess_values(t1old, t2old);
delta1 =3D t1 - t1old;
t1old =3D t1;
delta2 =3D t2 - t2old;
t2old =3D t2;
end
You need to write guess_values() of course.
|
|
0
|
|
|
|
Reply
|
ImageAnalyst
|
2/28/2011 11:46:58 AM
|
|
ImageAnalyst <imageanalyst@mailinator.com> wrote in message <07695a60-d351-42c0-b9e9-7cf22da5ac98@q2g2000pre.googlegroups.com>...
> On Feb 28, 6:41 am, "Jun Yi " <goodhandsomeh...@hotmail.com> wrote:
> > I am required to use Matlab to write a code to calcuate a value from guessing its initial value, i.e. using iteration method to obtain a value.
> >
> > I am new to Matlab, hence I have no idea how to write such code. Could anyone give me some advice for it? I also have outlined my problem as follows,
> >
> > 1. evaluate T1 and T2 from a set of equations from its initial guessed value
> > 2. Using initial guessed value of T1 and T2, and go though a set of equation, obtained a new value of T1 and T2
> > 3. subsitute these new T1 and T2, back to the set of equation from begining
> > 4. Carry out this iterative process untill the T1 and T2 are converged into constant values
> >
> > I will be much appreciated if my problem can be answered
> >
> > best regards
> > Jun
>
> -------------------------------
> Something like this maybe
>
> [t1old t2old] = guess_values();
> tolerance = 0.000001; % Whatever you want.
> while delta1 < tolerance && delta2 < tolerance
> [t1 t2] = guess_values(t1old, t2old);
> delta1 = t1 - t1old;
> t1old = t1;
> delta2 = t2 - t2old;
> t2old = t2;
> end
>
> You need to write guess_values() of course.
Thank you so much for your advice. I am mucn appriciated
The set of equations I used to calcuate the new T1 and T2 are quite complicated, I copy & paste as the follows,
%All the constants are defined
Ti=289;
Tinf=283;
Umin=106;
r1=0.001;
r2=0.003;
D1=2*r1;
D2=2*r2;
L=0.06;
P=4.14*10^5;
Rgas=287;
g=9.8;
ks=16.27;
%Step 1 => T1 and T2 are the initial vaule at the beginning
Tfilm_1=(Ti+T1)/2;
Tfilm_2=(Tinf+T2)/2;
%The set of equations that are used to calcuate new T1 and T2
Den1=P/(Rgas*Tfilm_1);
Vis_dy1=5*10^-10*Tfilm_1^3-3*10^-6*Tfilm_1^2+0.0059*Tfilm_1+0.2803;
Red=(Den1*Umin*D1)/(Vis_dy1*10^-5);
f=(0.79*log(Red)-1.64)^-2;
k1=-1*10^-6*Tfilm_1^2+0.0077*Tfilm_1+0.4301;
Pr1=-4*10^-20*Tfilm_1^6+2*10^-16*Tfilm_1^5-1*10^-13*Tfilm_1^4-5*10^-10*Tfilm_1^3+1*10^-6*Tfilm_1^2-0.0007*Tfilm_1+0.8455;
h1=((k1*10^-2)/D1)*(((f/8)*Red*Pr1)/(1.07+12.7*((f/8)^(1/2))*((Pr1^(2/3))-1)));
Beta=1/Tfilm_2;
Pr2=-4*10^-20*Tfilm_2^6+2*10^-16*Tfilm_2^5-1*10^-13*Tfilm_2^4-5*10^-10*Tfilm_2^3+1*10^-6*Tfilm_2^2-0.0007*Tfilm_2+0.8455;
k2=-1*10^-6*Tfilm_2^2+0.0077*Tfilm_2+0.4301;
Den2=P/(Rgas*Tfilm_2);
Cp=1*10^-10*Tfilm_2^4-5*10^-7*Tfilm_2^3+0.0008*Tfilm_2^2-0.295*Tfilm_2+1032.1;
Ra=(g*Beta*abs((Tr2-Tinf))*D2^3)/(Pr2*(((k2*10^-2)/(Den2*Cp))^2));
h2=((k2*10^-2)/D2)*((0.6+((0.387*Ra^(1/6))/(((1+(0.559/Pr2)^(9/16))^(8/27)))))^2);
q=(Ti-Tinf)/((1/(h1*2*pi*r1*L))+((log(r2/r1))/(2*pi*ks*L))+(1/(h2*2*pi*r2*L)));
%last part of equations calculate the new value of T1 and T2, and need to
%subsitue back to step 1
T1=Ti-q/(h1*2*pi*r1*L);
T2=Tinf+q/(h2*2*pi*r2*L);
It may be too lengthy and too many texts, any advices will be extremely helpful for me.
Thanks
Jun
|
|
0
|
|
|
|
Reply
|
Jun
|
2/28/2011 12:29:20 PM
|
|
OK, so that would be your guess_values() function
function [T1 T2] = guess_values(T1, T2)
% Paste all your code here
|
|
0
|
|
|
|
Reply
|
ImageAnalyst
|
2/28/2011 1:15:09 PM
|
|
ImageAnalyst <imageanalyst@mailinator.com> wrote in message <c3ad191d-0b9f-47f9-886a-a9bbf4741892@u24g2000prn.googlegroups.com>...
> OK, so that would be your guess_values() function
>
> function [T1 T2] = guess_values(T1, T2)
> % Paste all your code here
I am still a bit of confuse, could you explain more in detail??
I do appologize for any inconvenience I may cause
Thanks
Jun
|
|
0
|
|
|
|
Reply
|
Jun
|
2/28/2011 1:52:36 PM
|
|
On Feb 28, 8:52=A0am, "Jun Yi " <goodhandsomeh...@hotmail.com> wrote:
> I am still a bit of confuse, could you explain more in detail??
>
> I do appologize for any inconvenience I may cause
>
> Thanks
> Jun
---------------------------------------------------------------------------=
-
function [T1 T2] =3D guess_values(T1, T2)
% Paste all your code here
%All the constants are defined
Ti=3D289;
Tinf=3D283;
Umin=3D106;
r1=3D0.001;
r2=3D0.003;
D1=3D2*r1;
D2=3D2*r2;
L=3D0.06;
P=3D4.14*10^5;
Rgas=3D287;
g=3D9.8;
ks=3D16.27;
%Step 1 =3D> T1 and T2 are the initial vaule at the beginning
Tfilm_1=3D(Ti+T1)/2;
Tfilm_2=3D(Tinf+T2)/2;
%The set of equations that are used to calcuate new T1 and T2
Den1=3DP/(Rgas*Tfilm_1);
Vis_dy1=3D5*10^-10*Tfilm_1^3-3*10^-6*Tfilm_1^2+0.0059*Tfilm_1+0.2803;
Red=3D(Den1*Umin*D1)/(Vis_dy1*10^-5);
f=3D(0.79*log(Red)-1.64)^-2;
k1=3D-1*10^-6*Tfilm_1^2+0.0077*Tfilm_1+0.4301;
Pr1=3D-4*10^-20*Tfilm_1^6+2*10^-16*Tfilm_1^5-1*10^-13*Tfilm_1^4-5*10^-10*Tf=
ilm_1^3+1*10^-6*Tfilm_1^2-0.0007*Tfilm_1+0.8455;
h1=3D((k1*10^-2)/D1)*(((f/8)*Red*Pr1)/(1.07+12.7*((f/
8)^(1/2))*((Pr1^(2/3))-1)));
Beta=3D1/Tfilm_2;
Pr2=3D-4*10^-20*Tfilm_2^6+2*10^-16*Tfilm_2^5-1*10^-13*Tfilm_2^4-5*10^-10*Tf=
ilm_2^3+1*10^-6*Tfilm_2^2-0.0007*Tfilm_2+0.8455;
k2=3D-1*10^-6*Tfilm_2^2+0.0077*Tfilm_2+0.4301;
Den2=3DP/(Rgas*Tfilm_2);
Cp=3D1*10^-10*Tfilm_2^4-5*10^-7*Tfilm_2^3+0.0008*Tfilm_2^2-0.295*Tfilm_2+10=
32.1;
Ra=3D(g*Beta*abs((Tr2-Tinf))*D2^3)/(Pr2*(((k2*10^-2)/(Den2*Cp))^2));
h2=3D((k2*10^-2)/D2)*((0.6+((0.387*Ra^(1/6))/(((1+(0.559/
Pr2)^(9/16))^(8/27)))))^2);
q=3D(Ti-Tinf)/((1/(h1*2*pi*r1*L))+((log(r2/r1))/(2*pi*ks*L))+(1/
(h2*2*pi*r2*L)));
%last part of equations calculate the new value of T1 and T2, and need
to
%subsitue back to step 1
T1=3DTi-q/(h1*2*pi*r1*L);
T2=3DTinf+q/(h2*2*pi*r2*L);
|
|
0
|
|
|
|
Reply
|
ImageAnalyst
|
2/28/2011 2:10:50 PM
|
|
ImageAnalyst <imageanalyst@mailinator.com> wrote in message <fddfe668-cd53-4091-b1ec-7393c363164b@a11g2000pri.googlegroups.com>...
> On Feb 28, 8:52 am, "Jun Yi " <goodhandsomeh...@hotmail.com> wrote:
> > I am still a bit of confuse, could you explain more in detail??
> >
> > I do appologize for any inconvenience I may cause
> >
> > Thanks
> > Jun
> ----------------------------------------------------------------------------
> function [T1 T2] = guess_values(T1, T2)
> % Paste all your code here
> %All the constants are defined
> Ti=289;
> Tinf=283;
> Umin=106;
> r1=0.001;
> r2=0.003;
> D1=2*r1;
> D2=2*r2;
> L=0.06;
> P=4.14*10^5;
> Rgas=287;
> g=9.8;
> ks=16.27;
>
> %Step 1 => T1 and T2 are the initial vaule at the beginning
> Tfilm_1=(Ti+T1)/2;
> Tfilm_2=(Tinf+T2)/2;
>
> %The set of equations that are used to calcuate new T1 and T2
> Den1=P/(Rgas*Tfilm_1);
> Vis_dy1=5*10^-10*Tfilm_1^3-3*10^-6*Tfilm_1^2+0.0059*Tfilm_1+0.2803;
> Red=(Den1*Umin*D1)/(Vis_dy1*10^-5);
> f=(0.79*log(Red)-1.64)^-2;
> k1=-1*10^-6*Tfilm_1^2+0.0077*Tfilm_1+0.4301;
> Pr1=-4*10^-20*Tfilm_1^6+2*10^-16*Tfilm_1^5-1*10^-13*Tfilm_1^4-5*10^-10*Tfilm_1^3+1*10^-6*Tfilm_1^2-0.0007*Tfilm_1+0.8455;
> h1=((k1*10^-2)/D1)*(((f/8)*Red*Pr1)/(1.07+12.7*((f/
> 8)^(1/2))*((Pr1^(2/3))-1)));
>
> Beta=1/Tfilm_2;
> Pr2=-4*10^-20*Tfilm_2^6+2*10^-16*Tfilm_2^5-1*10^-13*Tfilm_2^4-5*10^-10*Tfilm_2^3+1*10^-6*Tfilm_2^2-0.0007*Tfilm_2+0.8455;
> k2=-1*10^-6*Tfilm_2^2+0.0077*Tfilm_2+0.4301;
> Den2=P/(Rgas*Tfilm_2);
> Cp=1*10^-10*Tfilm_2^4-5*10^-7*Tfilm_2^3+0.0008*Tfilm_2^2-0.295*Tfilm_2+1032.1;
> Ra=(g*Beta*abs((Tr2-Tinf))*D2^3)/(Pr2*(((k2*10^-2)/(Den2*Cp))^2));
> h2=((k2*10^-2)/D2)*((0.6+((0.387*Ra^(1/6))/(((1+(0.559/
> Pr2)^(9/16))^(8/27)))))^2);
>
> q=(Ti-Tinf)/((1/(h1*2*pi*r1*L))+((log(r2/r1))/(2*pi*ks*L))+(1/
> (h2*2*pi*r2*L)));
>
> %last part of equations calculate the new value of T1 and T2, and need
> to
> %subsitue back to step 1
> T1=Ti-q/(h1*2*pi*r1*L);
> T2=Tinf+q/(h2*2*pi*r2*L);
do i include WHILE or FOR loop to have the values iterated? I have tried the codes shown above, the valudes don't seem to be iterated.
Many thankds
Jun
|
|
0
|
|
|
|
Reply
|
Jun
|
2/28/2011 2:28:08 PM
|
|
On Feb 28, 9:28=A0am, "Jun Yi " <goodhandsomeh...@hotmail.com> wrote:
> do i include WHILE or FOR loop to have the values iterated? I have tried =
the codes shown above, the valudes don't seem to be iterated.
>
> Many thankds
> Jun
-------------------------------------------
Yes of course. You will still have this code:
[t1old t2old] =3D guess_values();
tolerance =3D 0.000001; % Whatever you want.
while delta1 < tolerance && delta2 < tolerance
[t1 t2] =3D guess_values(t1old, t2old);
delta1 =3D t1 - t1old;
t1old =3D t1;
delta2 =3D t2 - t2old;
t2old =3D t2;
end
All the last post did was to specify what the guess_values() function
was.
Of course you still need to call in in the loop.
|
|
0
|
|
|
|
Reply
|
ImageAnalyst
|
2/28/2011 3:35:37 PM
|
|
ImageAnalyst <imageanalyst@mailinator.com> wrote in message <b82707ad-f104-49ac-8b12-bcdebe591ca1@a21g2000prj.googlegroups.com>...
> On Feb 28, 9:28 am, "Jun Yi " <goodhandsomeh...@hotmail.com> wrote:
> > do i include WHILE or FOR loop to have the values iterated? I have tried the codes shown above, the valudes don't seem to be iterated.
> >
> > Many thankds
> > Jun
> -------------------------------------------
> Yes of course. You will still have this code:
> [t1old t2old] = guess_values();
> tolerance = 0.000001; % Whatever you want.
> while delta1 < tolerance && delta2 < tolerance
> [t1 t2] = guess_values(t1old, t2old);
> delta1 = t1 - t1old;
> t1old = t1;
> delta2 = t2 - t2old;
> t2old = t2;
> end
>
> All the last post did was to specify what the guess_values() function
> was.
> Of course you still need to call in in the loop.
From my best understanding, I need to produce two M-file, one contains the WHILE loop codes, as
[t1old t2old] = guess_values(200,100); %as my initial value
> tolerance = 0.000001; % Whatever you want.
> while delta1 < tolerance && delta2 < tolerance
> [t1 t2] = guess_values(t1old, t2old);
> delta1 = t1 - t1old;
> t1old = t1;
> delta2 = t2 - t2old;
> t2old = t2;
> end
Othe M-file is the FUNCTION code for guess_values()
Am I right?
Btw for the code for the WHILE loop, condtion delta1 and delta2 are not defined prior to be used in the WHILE loop statment. Do I need to modify it?
best regards
Jun
|
|
0
|
|
|
|
Reply
|
Jun
|
2/28/2011 6:05:04 PM
|
|
"Jun Yi " <goodhandsomehard@hotmail.com> wrote in message
news:ikg1l9$lai$1@fred.mathworks.com...
> I am required to use Matlab to write a code to calcuate a value from
> guessing its initial value, i.e. using iteration method to obtain a value.
>
> I am new to Matlab, hence I have no idea how to write such code. Could
> anyone give me some advice for it? I also have outlined my problem as
> follows,
>
> 1. evaluate T1 and T2 from a set of equations from its initial guessed
> value
> 2. Using initial guessed value of T1 and T2, and go though a set of
> equation, obtained a new value of T1 and T2
> 3. subsitute these new T1 and T2, back to the set of equation from
> begining
> 4. Carry out this iterative process untill the T1 and T2 are converged
> into constant values
So let's call:
T = [T1; T2]
Am I correct in describing your problem as you're trying to find a T such
that:
T = f(T)
If so, use FSOLVE from Optimization Toolbox on:
g(T) = f(T) - T
If g(T) has a solution Tsolution such that g(Tsolution) = 0 then
f(Tsolution) = Tsolution.
--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com
|
|
0
|
|
|
|
Reply
|
Steven_Lord
|
2/28/2011 6:56:35 PM
|
|
"Steven_Lord" <slord@mathworks.com> wrote in message <ikgr4s$gfr$1@fred.mathworks.com>...
>
>
> "Jun Yi " <goodhandsomehard@hotmail.com> wrote in message
> news:ikg1l9$lai$1@fred.mathworks.com...
> > I am required to use Matlab to write a code to calcuate a value from
> > guessing its initial value, i.e. using iteration method to obtain a value.
> >
> > I am new to Matlab, hence I have no idea how to write such code. Could
> > anyone give me some advice for it? I also have outlined my problem as
> > follows,
> >
> > 1. evaluate T1 and T2 from a set of equations from its initial guessed
> > value
> > 2. Using initial guessed value of T1 and T2, and go though a set of
> > equation, obtained a new value of T1 and T2
> > 3. subsitute these new T1 and T2, back to the set of equation from
> > begining
> > 4. Carry out this iterative process untill the T1 and T2 are converged
> > into constant values
>
> So let's call:
>
> T = [T1; T2]
>
> Am I correct in describing your problem as you're trying to find a T such
> that:
>
> T = f(T)
>
> If so, use FSOLVE from Optimization Toolbox on:
>
> g(T) = f(T) - T
>
> If g(T) has a solution Tsolution such that g(Tsolution) = 0 then
> f(Tsolution) = Tsolution.
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com
Thank you for your advice, can you give me more detail on how to construct FSOLVE codes, I am new to Matlab, it may take me some times to understand, the equations I am using to calculate the new values of T1 and T2 are quite complicated, and I am not sure how to write FSOLVE codes to solve these equations, I copied and paste the equations as below,
%All the constants are defined
Ti=289;
Tinf=283;
Umin=106;
r1=0.001;
r2=0.003;
D1=2*r1;
D2=2*r2;
L=0.06;
P=4.14*10^5;
Rgas=287;
g=9.8;
ks=16.27;
%Step 1 => T1 and T2 are the initial vaule at the beginning
Tfilm_1=(Ti+T1)/2;
Tfilm_2=(Tinf+T2)/2;
%The set of equations that are used to calcuate new T1 and T2
Den1=P/(Rgas*Tfilm_1);
Vis_dy1=5*10^-10*Tfilm_1^3-3*10^-6*Tfilm_1^2+0.0059*Tfilm_1+0.2803;
Red=(Den1*Umin*D1)/(Vis_dy1*10^-5);
f=(0.79*log(Red)-1.64)^-2;
k1=-1*10^-6*Tfilm_1^2+0.0077*Tfilm_1+0.4301;
Pr1=-4*10^-20*Tfilm_1^6+2*10^-16*Tfilm_1^5-1*10^-13*Tfilm_1^4-5*10^-10*Tfilm_1^3+1*10^-6*Tfilm_1^2-0.0007*Tfilm_1+0.8455;
h1=((k1*10^-2)/D1)*(((f/8)*Red*Pr1)/(1.07+12.7*((f/8)^(1/2))*((Pr1^(2/3))-1)));
Beta=1/Tfilm_2;
Pr2=-4*10^-20*Tfilm_2^6+2*10^-16*Tfilm_2^5-1*10^-13*Tfilm_2^4-5*10^-10*Tfilm_2^3+1*10^-6*Tfilm_2^2-0.0007*Tfilm_2+0.8455;
k2=-1*10^-6*Tfilm_2^2+0.0077*Tfilm_2+0.4301;
Den2=P/(Rgas*Tfilm_2);
Cp=1*10^-10*Tfilm_2^4-5*10^-7*Tfilm_2^3+0.0008*Tfilm_2^2-0.295*Tfilm_2+1032.1;
Ra=(g*Beta*abs((T2-Tinf))*D2^3)/(Pr2*(((k2*10^-2)/(Den2*Cp))^2));
h2=((k2*10^-2)/D2)*((0.6+((0.387*Ra^(1/6))/(((1+(0.559/Pr2)^(9/16))^(8/27)))))^2);
q=(Ti-Tinf)/((1/(h1*2*pi*r1*L))+((log(r2/r1))/(2*pi*ks*L))+(1/(h2*2*pi*r2*L)));
%last part of equations calculate the new value of T1 and T2, and need to
%subsitue back to step 1
T1=Ti-q/(h1*2*pi*r1*L);
T2=Tinf+q/(h2*2*pi*r2*L);
I do appologize my equations are a bit lengthy and any inconvenience I may cause
Many Thanks
Jun
|
|
0
|
|
|
|
Reply
|
Jun
|
2/28/2011 7:19:23 PM
|
|
"Jun Yi " <goodhandsomehard@hotmail.com> wrote in message
news:ikgsfr$fph$1@fred.mathworks.com...
> "Steven_Lord" <slord@mathworks.com> wrote in message
> <ikgr4s$gfr$1@fred.mathworks.com>...
*snip*
> Thank you for your advice, can you give me more detail on how to construct
> FSOLVE codes, I am new to Matlab, it may take me some times to understand,
> the equations I am using to calculate the new values of T1 and T2 are
> quite complicated, and I am not sure how to write FSOLVE codes to solve
> these equations, I copied and paste the equations as below,
The documentation for FSOLVE describes how it expects the function that you
pass it to behave. Basically, for this problem you're going to want to
write a function that accepts an input T and using that T computes f(T)-T,
which if you have a function that uses T to compute f(T) [which it appears
you do] should be easy.
*snip*
--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com
|
|
0
|
|
|
|
Reply
|
Steven_Lord
|
2/28/2011 7:25:32 PM
|
|
"Steven_Lord" <slord@mathworks.com> wrote in message <ikgsr5$9fp$1@fred.mathworks.com>...
>
>
> "Jun Yi " <goodhandsomehard@hotmail.com> wrote in message
> news:ikgsfr$fph$1@fred.mathworks.com...
> > "Steven_Lord" <slord@mathworks.com> wrote in message
> > <ikgr4s$gfr$1@fred.mathworks.com>...
>
> *snip*
>
> > Thank you for your advice, can you give me more detail on how to construct
> > FSOLVE codes, I am new to Matlab, it may take me some times to understand,
> > the equations I am using to calculate the new values of T1 and T2 are
> > quite complicated, and I am not sure how to write FSOLVE codes to solve
> > these equations, I copied and paste the equations as below,
>
> The documentation for FSOLVE describes how it expects the function that you
> pass it to behave. Basically, for this problem you're going to want to
> write a function that accepts an input T and using that T computes f(T)-T,
> which if you have a function that uses T to compute f(T) [which it appears
> you do] should be easy.
>
> *snip*
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com
Hi, I tried to use FSOLVE to solve equations I have, since the equations require two inputs, T1 and T2, to get the its new value, so i write "fsolve(@ts,100,200)" [ts is function name, and 100,200 are the input value], but i got the error message all the time. Any solution for that?
best regards
Jun
|
|
0
|
|
|
|
Reply
|
Jun
|
2/28/2011 8:46:21 PM
|
|
"Jun Yi " <goodhandsomehard@hotmail.com> wrote in message
news:ikh1it$ffj$1@fred.mathworks.com...
> "Steven_Lord" <slord@mathworks.com> wrote in message
> <ikgsr5$9fp$1@fred.mathworks.com>...
*snip*
> Hi, I tried to use FSOLVE to solve equations I have, since the equations
> require two inputs, T1 and T2, to get the its new value, so i write
> "fsolve(@ts,100,200)" [ts is function name, and 100,200 are the input
> value], but i got the error message all the time. Any solution for that?
Pass in the initial guess as a VECTOR rather than two separate scalar
inputs.
--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com
|
|
0
|
|
|
|
Reply
|
Steven_Lord
|
2/28/2011 9:26:34 PM
|
|
"Steven_Lord" <slord@mathworks.com> wrote in message <ikh3u3$ir5$1@fred.mathworks.com>...
>
>
> "Jun Yi " <goodhandsomehard@hotmail.com> wrote in message
> news:ikh1it$ffj$1@fred.mathworks.com...
> > "Steven_Lord" <slord@mathworks.com> wrote in message
> > <ikgsr5$9fp$1@fred.mathworks.com>...
>
> *snip*
>
> > Hi, I tried to use FSOLVE to solve equations I have, since the equations
> > require two inputs, T1 and T2, to get the its new value, so i write
> > "fsolve(@ts,100,200)" [ts is function name, and 100,200 are the input
> > value], but i got the error message all the time. Any solution for that?
>
> Pass in the initial guess as a VECTOR rather than two separate scalar
> inputs.
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com
Hi, Lord
I finally understand how FSOLVE coeds work, however, I am facing another issue, the answer I got states that,
" Optimizer appears to be converging to a point which is not a root.
Norm of relative change in X is less than max(options.TolX^2,eps) but
sum-of-squares of function values is greater than or equal to sqrt(options.TolFun)
Try again with a new starting guess."
and the answers are in double complex format,
how can I solve this problem, and how to present the answer in scalar form?
best regards
|
|
0
|
|
|
|
Reply
|
Jun
|
3/1/2011 4:14:08 PM
|
|
|
14 Replies
336 Views
(page loaded in 0.153 seconds)
Similiar Articles: How to write a code for iteration process - comp.soft-sys.matlab ...I am required to use Matlab to write a code to calcuate a value from guessing its initial value, i.e. using iteration method to obtain a value. I a... how to write a constraint function for optimtool??? - comp.soft ...How to write a code for iteration process - comp.soft-sys.matlab ... how to write a constraint function for optimtool??? - comp.soft ... How to write a code for iteration ... Write sequence text files within a loop - comp.soft-sys.matlab ...Write sequence text files within a loop - comp.soft-sys.matlab ... Write sequence text files within a loop - comp.soft-sys.matlab ... Writing non ASCII text files ... nonlinear newton raphson iteration code - comp.soft-sys.matlab ...How to write a code for iteration process - comp.soft-sys.matlab ... nonlinear newton raphson iteration code - comp.soft-sys.matlab ... How to write a code for iteration ... How to write a VHDL code for 1Hz signal? - comp.lang.vhdl ...How to write a code for iteration process - comp.soft-sys.matlab ... How to write a VHDL code for 1Hz signal? - comp.lang.vhdl ... How to write a code for iteration ... how to solve symbolic function with initial values - comp.soft-sys ...How to write a code for iteration process - comp.soft-sys.matlab ..... code to calcuate a value from guessing its initial value ... > OK, so that would be your guess ... How to get matrix output by using parfor loop - comp.soft-sys ...> > > > if I run the following code : > > parfor i = 1:10; > > a = i*rand(3 ... need to kill worker process in parfor loop - comp.soft-sys.matlab ..... soft-sys.matlab Fill ... How to write testbench file? - comp.lang.vhdlI don't think I'm alone in that every line of code I write is ... could be re-written as previously shown with a loop ... end foo; architecture rtl of foo is begin process ... Regula Falsi Method - comp.soft-sys.matlabnonlinear newton raphson iteration code - comp.soft-sys.matlab ... How to write a code for iteration process - comp.soft-sys ... Please help with newton raphson method in ... Recursive Programming and Assembly Language - comp.lang.asm.x86 ...BTW, here's the MASM code that HLA generates for the "recursive" procedure, so ... of course, that you write the code in an ... of the foreach // loop in the caller's code ... File Name for each iteration in for-loop - comp.soft-sys.matlab ...How to write a code for iteration process - comp.soft-sys.matlab ... File Name for each iteration in for-loop - comp.soft-sys.matlab ... how to create each file for each ... need to kill worker process in parfor loop - comp.soft-sys.matlab ...If iter is set to 50, its ok if i only get 48 iterations out of the code. ... for MATLAB script - comp.soft ... need to kill worker process in parfor loop - comp ... Loop within a Proc Mixed or Proc Autoreg statement - comp.soft-sys ...... 25 Proc Mixed commands, is there any way I can write a loop ... This is my code: proc mixed data=returns1; model y ... section titled: A macro program for repeating a procedure ... storing iteration results when using for loop. - comp.soft-sys ...... in data but could easily be modified to write ... someone please help= me to modify the code to ... Each repetition of the process is called an 'iteration', and the results of Use MPI inside a for loop - comp.parallel.mpi... all, I need to make below code MPI'ed. Inside the "for" loop ... Solve w1 = solve(s1[m]) with process ... Write sequence text files within a loop - comp.soft-sys.matlab ... How to write a code for iteration process - comp.soft-sys.matlab ...I am required to use Matlab to write a code to calcuate a value from guessing its initial value, i.e. using iteration method to obtain a value. I a... How to write a code for iteration process - Newsreader - MATLAB ...I am required to use Matlab to write a code to calcuate a value from guessing its initial value, i.e. using iteration method to obtain a value. 7/25/2012 7:27:25 PM
|