Hi,(adsbygoogle = window.adsbygoogle || []).push({});

Please I need your assistance in solving this matlab problem. Thanks for your anticipated help

I have three functions

First one

function f_PR_W=newtonphasemolefraction1(W_PR, z,C,K_PR )

f_PR=0;

for c=1:C

f_PR_W=f_PR+z(c).*(1-K_PR(c))./(1+W_PR.*(K_PR(c)-1));

end

Another function

function fdot_PR_W=newtonphasemolefraction2(W_PR, z,C,K_PR )

fdot_PR=0;

for c=1:C

fdot_PR_W=fdot_PR+z(c).*(K_PR(c)-1).^2/(W_PR.*(K_PR(c)-1)+1).^2;

end

The third function

function [W_PR,err,k,f_PR_W]=newton1(newtonphasemolefraction1,newtonphasemolefraction2,W_PR,Tol_W_PR,Tol_f_PR,maxIter)

for k=1:maxIter

p1=W_PR-newtonphasemolefraction1(W_PR)/newtonphasemolefraction2(W_PR);

err=abs(p1-W_PR);

relerr=2*err/(abs(p1)+Tol_W_PR);

W_PR=p1;

f_PR_W=newtonphasemolefraction1(W_PR);

if (err<Tol_W_PR)|(relerr<Tol_W_PR)|(abs(f_PR_W)<Tol_f_PR),break,end

end

I call the three functions using

[W_PR,err,k,f_PR_W]=newton1(newtonphasemolefraction1,newtonphasemolefraction2,W_PR,Tol_W_PR,Tol_f_PR,maxIter)

I received the following error

"Error using newtonphasemolefraction1 (line 3)

Not enough input arguments."

And all input arguments were defined: K_PR=[0.01546,0.5,1.432],W_PR=0.25,Tol_W_PR=10^-6, Tol_f_PR=10^-10, maxIter=100, z=[0.1 0.3 0.6],C=3

Please assist.

Best regards,

adeeyo

**Physics Forums - The Fusion of Science and Community**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Errors in using multiple functions in matlab

Loading...

Similar Threads - Errors using multiple | Date |
---|---|

Mathematica Errors when plotting but not when evaluating | Mar 13, 2018 |

Using Maxima to plot error in Fourier series | Nov 5, 2017 |

Error message using 'double' ? | Feb 16, 2012 |

Mathematica: Infinite expression error when using NDSolve | Jan 21, 2012 |

Matlab Function - Error using => horzcat | Nov 16, 2011 |

**Physics Forums - The Fusion of Science and Community**