Different results for formula in Matlab and Excel
Mostra commenti meno recenti
I derived a formula using a long calculation and it gives satisfactory answer (1759) when variables are replaced in Matlab
f__prime_c=4000;
kd=44.928;
epsilon_o=2*4000/(57000*sqrt(4000));
epsilon_ct=0.003;
epsilon_c=0.001264;
epsilon_ult=0.003;
z=150;
double((3*f__prime_c*kd*(epsilon_c^3-3*epsilon_c^2*epsilon_o+2*epsilon_o^3))/(500*epsilon_o^2*epsilon_ct)-(9*f__prime_c*kd*(-epsilon_ct^2+epsilon_o*epsilon_ult)*(-z*epsilon_ct^2+2*epsilon_ult+epsilon_o*epsilon_ult*z))/(1000*epsilon_ct*epsilon_ult^2))
But when I bring the same equation in a cell in excel ,answers is different.
I had made sure that replacement is correct but everytime I replace variables with cells or even with numerical values in excel ,answer is different from Matlab.
The Numerical values for variables are same in matlab and excel.
Any apparent reasons for the problem?
Btw answer is 1759 in matlab and -4332 in excel
6 Commenti
DGM
il 21 Apr 2021
I don't know why your excel spreadsheet doesn't match, because I can't guess what you put in it. Considering that I can't even get the same results in Matlab, I have no idea.
f__prime_c=4000;
kd=44.928;
epsilon_o=2*4000/(57000*sqrt(4000));
epsilon_ct=0.003;
epsilon_c=0.001264;
epsilon_ult=0.003;
z=150;
% the original
R0 = double((3*f__prime_c*kd*(epsilon_c^3-3*epsilon_c^2*epsilon_o+2*epsilon_o^3))/(500*epsilon_o^2*epsilon_ct)-(9*f__prime_c*kd*(-epsilon_ct^2+epsilon_o*epsilon_ult)*(-z*epsilon_ct^2+2*epsilon_ult+epsilon_o*epsilon_ult*z))/(1000*epsilon_ct*epsilon_ult^2))
% it's a lot easier to read giant expressions if they're split up somehow.
An = (3*f__prime_c*kd*(epsilon_c^3-3*epsilon_c^2*epsilon_o+2*epsilon_o^3));
Ad = (500*epsilon_o^2*epsilon_ct);
Bn = (9*f__prime_c*kd*(-epsilon_ct^2+epsilon_o*epsilon_ult)*(-z*epsilon_ct^2+2*epsilon_ult+epsilon_o*epsilon_ult*z));
Bd = (1000*epsilon_ct*epsilon_ult^2);
% the results are the same anyway
R = An/Ad - Bn/Bd
Both give 1759
R0 =
1759
R =
1759
Osama Anwar
il 21 Apr 2021
Osama Anwar
il 21 Apr 2021
Modificato: Osama Anwar
il 21 Apr 2021
Osama Anwar
il 21 Apr 2021
Osama Anwar
il 21 Apr 2021
Osama Anwar
il 21 Apr 2021
Risposta accettata
Più risposte (2)
Jan
il 21 Apr 2021
0 voti
It looks, like you have a typo in the code you have typed in Excel.
4 Commenti
Osama Anwar
il 21 Apr 2021
Image Analyst
il 21 Apr 2021
But did you define the range correctly so that the named range points to the actual correct cell? You keep forgetting to attach the Excel workbook. Why are you not attaching it???
Osama Anwar
il 21 Apr 2021
Osama Anwar
il 21 Apr 2021
Osama Anwar
il 21 Apr 2021
0 voti
Categorie
Scopri di più su Data Import from MATLAB in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

