Data type causing mismatch between Excel and Matlab
정보
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
이전 댓글 표시
I have defined a matlab function (see below) with some inputs and outputs. Outputs are a result of some equations with in the matlab function. There is one such equation that computes values very close to 1.0 and because of the data type issue, i am not able to match the excel results to matlab results. I prototyped the model in Excel already and after satisfactory results, i started building up the model in matlab for a more wider analysis of data. Here is the code:
function [A, B, C, D, E,F,G,H] = Control(Rawdata, a, b, c, Constant1)
D = Rawdata/(constant*a);
if(D>=1)
value=1;
else
value=0;
end
As I mentioned earlier, D ranges between 0.978 to 1.004. My model is based on this D value equal to or greater than 1.0. Matlab's output has more 1s than excel and I guess number precision is the cause. Can someone help me figure this out.
Thanks a lot.
댓글 수: 1
Geoff Hayes
2014년 11월 12일
Rama - does the Excel implementation have a similar function that computes D as above? If so, what can you say about the Rawdata, constant, and a variables that both MATLAB and EXCEL use? Are they identical, similar or ..? It must be one of these three variables that is causing the difference between the two applications.
답변 (0개)
이 질문은 마감되었습니다.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!