Need help converting equation into matlab code.

Dear all,
I need help to convert this equation into matlab code.
This is the code i'm currently working with and my attempt to convert it,
c1 = 0.518;
c2 = 116;
c3 = 0.4;
c4 = 5;
c5 = 21;
c6 = 0.0069;
lambda = 0:0.01:16;
beta = 2;
u = 1./(1./(lambda+0.08*beta)-0.035./((beta.^3)+1));
cp = c1.*(c2./u)-(c3.*beta-c4).*(exp(-c5./u))+(c6.*lambda);
cp doesn't return the correct values.
Thank you.

 Accepted Answer

Torsten
Torsten on 21 Nov 2022
Edited: Torsten on 21 Nov 2022
cp = c1*(c2./u - c3*beta - c4).*exp(-c5./u) + c6*lambda;
instead of
cp = c1.*(c2./u)-(c3.*beta-c4).*(exp(-c5./u))+(c6.*lambda);

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Asked:

on 21 Nov 2022

Edited:

on 21 Nov 2022

Community Treasure Hunt

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

Start Hunting!