I want the value of gama1 to be obtained from the following equation.

following is the code that i have written for obtaining the value of the 'gama1' variable. The issue i am facing is that when i run the code, i am gettin an error message but then again, it still gives the value of 'gama1'. so i wanted to know whats actually goin wrong with my code.
T0= (4.5e-4-(8*Tw*K))./((4.5e-4)-20*K);
T1=(4*T0-Tw)/3;
%gama1=0.6;
der1=(gama1-gama_p)/(2*h);
AA=m*C.*power(T0,v)*(gama_p^n)*power(der1,(m-1))* (gama1+gama_p)/(h^2);
BB= v*C.*power(T0,v-1)*(gama_p^(n))*power(der1,m).*((T1-Tw)/(2*h));
ZZ=n*C*power(der1,m+1).*power(T0,v)*(gama_p^(n-1))-C.*D*der1;
%function F=hola(gama1,gama_p,h,m,C,T0,v,n,T1,Tw,D)
%F=@(gama1) AA+BB+ZZ;
F=@(gama1) (m*C.*power(T0,v)*(gama_p^n)*power(der1,(m-1))* (gama1+gama_p)/(h^2))+(v*C.*power(T0,v-1)*(gama_p^(n))*power(der1,m).*((T1-Tw)/(2*h)))+(n*C*power(der1,m+1).*power(T0,v)*(gama_p^(n-1))-C.*D*der1);
gama1=fzero(F,0);
in the above equation , i have values of all the parameters.
Thank you helpers.much appreciated :-)

 Accepted Answer

I can’t run your code, but I would vectorise everything in your ‘F’ function to be certain you are doing element-wise operations (if that is what you want to do). See Array vs Matrix Operations for details.

3 Comments

thanks Strider..... if thats the case, ie you are not able to run the code thel i'll provide you with the whole of the code with all the required parameters. I too am getting the error that 'gama1' is not defined for the fuction that i am writing to find 'gama1'. could you please do the needful. Thanks mate....
zeta=linspace(0,2); alpha=10; k=54; c=500; rho=7800; w=0.5; m=0.019; n=0.015; v=-0.38; V=15; t1=0.5; %Tint(1)=500; beta=1; Tw=30; mu0=3750e6; h=0.025e-3; gama_p=0.01; y=500; Q=zeros(10,1); i=[1:1:10]; Tint=zeros(10,1); for i=1:1:10, Tint(i)=y; u=i;
y=y+100;
Q(i)=i;
end
%display(Q)
for i=1:10, if Tint(i)<=955, mu(i)=1-(3.44e-4)*Tint(i); else A=1-((Tint(i)-955)./(1500-955)); mu(i)=0.68*power(A,1.7); end; end;
lamda=atan(mu)*180/pi;
phi = 35 + (0.5*(alpha-(atan(mu)*180/pi)));
vc=V*sind(phi)/cosd(phi-alpha);
%lc=t1*sind(phi+lamda-alpha)./(sind(phi)*cosd(lamda));
lc=t1*(sind(phi-alpha)+(tand(lamda).*cosd(phi-alpha)))/sind(phi);
%strain=tand(phi-alpha)+(1./tand(phi));
ref_strain=(V*cosd(alpha))./(h*cosd(phi-alpha));
ref_stress=mu0*(Tw^v).*power(ref_strain,m);
B=(beta*ref_stress)/(rho*c*Tw);
C=(sind(phi).*cosd(phi-alpha))./cosd(alpha);
D=((rho*(V^2))*sind(phi)*cosd(alpha))./(ref_stress.*cosd(phi-alpha));
K=k*cosd(phi-alpha)./(rho*c*h*V*cosd(alpha));
gmma2=(1./tand(phi))+tand(phi-alpha);
T0= (4.5e-4-(8*Tw*K))./((4.5e-4)-20*K);
T1=(4*T0-Tw)/3;
%gama1=0;
der1=(gama1-gama_p)/(2*h);
% AA=m*C.*power(T0,v)*(gama_p^n)*power(der1,(m-1))* (gama1+gama_p)/(h^2);
% BB= v*C.*power(T0,v-1)*(gama_p^(n))*power(der1,m).*((T1-Tw)/(2*h));
% ZZ=n*C*power(der1,m+1).*power(T0,v)*(gama_p^(n-1))-C.*D*der1;
% function F=hola(gama1,gama_p,h,m,C,T0,v,n,T1,Tw,D) %F=@(gama1) AA+BB+ZZ; %syms gama1
%F=inline('m*C.*power(T0,v)*(gama_p^n)*power(der1,(m-1))* (gama1+gama_p)/(h^2))+(v*C.*power(T0,v-1)*(gama_p^(n))*power(der1,m).*((T1-Tw)/(2*h)))+(n*C*power(der1,m+1).*power(T0,v)*(gama_p^(n-1))-C.*D*der1')
F=@(gama1) (m*C.*power(T0,v)*(gama_p^n)*power(der1,(m-1))* (gama1+gama_p)/(h^2))+(v*C.*power(T0,v-1)*(gama_p^(n))*power(der1,m).*((T1-Tw)/(2*h)))+(n*C*power(der1,m+1).*power(T0,v)*(gama_p^(n-1))-C.*D*der1);
gama1=fzero(F,0);
M=(power(T0,v));
N=M';
tou0=C*(((gama1-gama_p)/(2*h))^(m))*N*(gama_p^(n));
tou=rho*(power(V*sin(phi),2)*gama1)+tou0;
I can’t figure out what you’re doing. You said that it gives you the (I assume correct) value for ‘gama1’ but gives an error message.
What is the error message? Please copy and paste all the red output in the Command Window here. Include the line that is throwing the error. (It could be throwing a warning message instead.)

Sign in to comment.

More Answers (0)

Categories

Find more on Function Creation in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!