Question: There must be Error using fprintf Unable to convert 'sym' value to 'double'. Error in Quiz2pt2 (line 65) fprintf('There must be %4.2f moles of NH3

There must be Error using fprintf Unable to convert 'sym' value to 'double'.

Error in Quiz2pt2 (line 65) fprintf('There must be %4.2f moles of NH3 produced to raise the blood pH back to a normal 7.4. ',Z(1));

Why am I receiving this error??

Code:

%% Analyze:

% Assume: Open, Reactive, Dynamic

% Basis/Given:

Ka=5.6*10^-10; %M

Vblood= 5000; %mL

pHi=7.2;

pHf=7.4;

mAo=(60/100)*Vblood; %ug

MWnh4=18039000 %um/mol

nAo=mAo/MWnh4

nHo=10^(-pHi)*Vblood;

nHf=10^(-pHf)*Vblood;

% HA: nHAq=nHAf-nHAo

% H: -nHc=nHf-nHo

% A: nAi-nAc=nAf

%% Calculate:

syms nHAo Kap nHo nAo

E1='Kap=Vblood*Ka';

E1a='Kap =((nHo*nAo)/nHAo)';

E1b='nAo=(60/100)*Vblood';

E1c='nHo=10^(-pHo)*Vblood';

X=solve(E1,E1a,E1b,E1c,nHAo,Kap,nHo,nAo);

nHAo=X.nHAo;

%n.Hi-n.Hc=n.Hf-n.Ho

%-n.Ac=n.Af-n.A0

%n.HAg=n.HAf-n.HAo

%Kap=(n.hf*n.Af)/n.HAf

%n.Hc=n.Ac

%n.Ac=n.HAg

Kap=Vblood*Ka;

nAo=(60/100)*Vblood;

nHo=10^(-pHi)*Vblood;

M=[1,-1,0,0,0,0;

0,0,-1,-1,0,0;

0,0,0,0,1,-1;

0,0,0,-nHf,0,Kap;

0,1,-1,0,0,0;

0,0,1,0,-1,0];

b=[nHf-nHo;

-nAo;

-nHAo;

0;

0;

0];

Z=M\b;

Z(1)

%% Finalize:

fprintf('There must be %4.2f moles of NH3 produced to raise the blood pH back to a normal 7.4. ',Z(1));

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!