F @ (X) Exp (X) - Exp (-2 X) +1 Akar Fzero (F, 0.5) Akar - 0.2812

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

>> f=@(x)exp(x)-exp(-2*x)+1;

>> akar=fzero(f,0.5)

akar =

-0.2812

>> %kasus kapasitas panas

cp=input('masukkan capasitas panas,kJ/kg.K= ')

f=@(T)cp-0.745+4737e-6*T-15.65/T^0.5;

T=fzero(f,50)

masukkan capasitas panas,kJ/kg.K= 2.5

cp =

2.5000

T =

59.1353

clc
R=0.082054; % L.atm/(mol.K)
a=1.360; % L^2.atm/(mol^2)
b=0.03138; % L/mol
T=450; % K
P=[1:10]; % atm
for i=P
f=@(V)(i+a./V.^2).*(V-b)-R*T;
Volume(i)=fzero(f,20);
end
[P' Volume']
ans =

1.0000 36.9189

2.0000 18.4567

3.0000 12.3027

4.0000 9.2257

5.0000 7.3795
6.0000 6.1488

7.0000 5.2696

8.0000 4.6103

9.0000 4.0975

10.0000 3.6872

>> f=@(x)(x*(1+x^2)*log(x)-x^2+1);

>> akar=fzero(f,0.5)

Exiting fzero: aborting search for an interval containing a sign change

because complex function value encountered during search.

(Function value at -0.14 is 1.2611-0.44844i.)

Check function or try again with a different starting value.

akar =

NaN

>> f=@(x)[2*x(1)-3*x(2)-exp(-2*x(1));-x(1)+4*x(2)-2*exp(-x(2))];

>> xo=[-3 -2];

>> X=fsolve(f,xo)

Equation solved.

fsolve completed because the vector of function values is near zero

as measured by the default value of the function tolerance, and

the problem appears regular as measured by the gradient.


<stopping criteria details>

X=

0.8607 0.5142

You might also like