Thread Subject:
solve and fzero don't work fast and good enough for this.

Subject: solve and fzero don't work fast and good enough for this.

From: Nicolas

Date: 28 Mar, 2012 15:04:12

Message: 1 of 1

Hello guys I have this problem:

x^4=f(x)
f(x)=complicated function of x with powers like -15/4 1/6 a/b etc...


 I need to solve this equation which the command "solve" does but too slow.
So I mix the command fzero which need a "guess" solution wich I obtain only one time from the solve command. But the thing is that at some point fzero can't find the solution and gives me NaN. Which obviously are wrong. (I already solve some of the points with the solve command to check if there is no solution but there is a solution.)

So how can I attach this problem?

Here is a portion of the code to get you an idea: (For now x=T_pp2)

syms T_pp2

omega_uno=real(omega(floor(end/3)));
nu_uno=real(nu(1,floor(end/3)));
u_uno=real(u(1,floor(end/3)));

k_abs_ast=4.7e20.*omega_uno.*T_pp2.^(-15/4);
epsilon_ast=k_abs_ast./(k_abs_ast+k_es);
A=solve(T_pp2-(9.*nu_uno.*u_uno.*omega_uno.^2.*(1-0.27.*epsilon_ast.^(5/6)).*(1+(epsilon_ast.^(-1)-1).^(2/3))./(8.*sigma_sb.*0.873.*epsilon_ast.^(-1/6))).^0.25);
A=eval(floor(A));

%%% The code above is the slow one, that is the reason why I only solve but one point at the beginning of my iteration in order to obtain the first solution and put it in the following code.%%%

%from now x=T_p
%%%This is the complicated form of the equation but essentialy is T_p^4=f (T_p)%%%%

f=@(T_pp,u_eq,omega_eq,nu_eq,k_es,sigma_sb) T_pp-(9.*nu_eq.*u_eq.*omega_eq.^2.*(1-0.27.*((4.7e20.*omega_eq.*T_pp.^(-15/4))./((4.7e20.*omega_eq.*T_pp.^(-15/4))+k_es)).^(5/6)).*(1+(((4.7e20.*omega_eq.*T_pp.^(-15/4))./((4.7e20.*omega_eq.*T_pp.^(-15/4))+k_es)).^(-1)-1).^(2/3))/(8.*sigma_sb.*0.873.*((4.7e20.*omega_eq.*T_pp.^(-15/4))./((4.7e20.*omega_eq.*T_pp.^(-15/4))+k_es)).^(-1/6))).^0.25;

for jjt=1:at
     
    for jjx=1:n
      omega_uno=omega(jjx);
      nu_uno=real(nu(jjt,jjx));
      u_uno=real(u(jjt,jjx));
      %T_p(jjt,jjx)= fzero(f,A,[],u_uno,omega_uno,nu_uno,k_es,sigma_sb);
      T_p(jjt,jjx)= fzero(f,A,[],u_uno,omega_uno,nu_uno,k_es,sigma_sb);
    end
jjt
end

%%%The code above is really really fast. But

Any ideas??? please.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
fzero Nicolas 28 Mar, 2012 11:04:21
solve Nicolas 28 Mar, 2012 11:04:21
rssFeed for this Thread

Contact us