Error in dividing the data

1 view (last 30 days)
Pat
Pat on 23 Nov 2012
I have two values from workspace
Cww=0
0
0
32
0
0
0
0
0
0
Eww=0
0
31
250
345
376
188
63
0
0
my code
for i=1:length(Cww)
S11(i)=100*Eww(i);
Fw(i)=Cww(i)/S11(i);
end
after this i get ans as
Fw=0 0 0 0 0 0 0 0 0 0
i get answer in row wise ,and result is wrong getting all zeros
I tried to do separately in command window
i get answer as
0
0
32767
8
32767
32767
32767
32767
0
0
why i get different answers,why i get 32767value plz provide assistance

Accepted Answer

Walter Roberson
Walter Roberson on 23 Nov 2012
Check the class() of your data. You are probably going to find that Eww (and possibly others) is int16 data class. Use double() to convert values from int16 to double precision.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!