Hello, I'm trying to make some calculation with vectors and matrix, with functions as sin, cos and operators, but comparing with excell...it gives me differences of 0,0004...I have tried with vpa, but...anyone can help me please?
1 view (last 30 days)
Show older comments
Loghin Ana-Maria
on 14 Jun 2015
Commented: Loghin Ana-Maria
on 15 Jun 2015
teta_transmis(1,1)=teta+beta(1);%calculul primei orientari
if teta_transmis(1,1) > 400
teta_transmis(1,1)=teta_transmis(1,1)-400;
end
n=length(beta);
for i=2:n
teta_transmis(i,1)=vpa(teta_transmis(i-1,1)+200+beta(i),50);
if teta_transmis(i,1)>400
teta_transmis(i,1)=vpa(teta_transmis(i,1)-400,50);
end;
end;
6 Comments
Accepted Answer
John D'Errico
on 15 Jun 2015
This is an extremely common error made by people.
Usually this has happened not because of the computations, but because of the precision of the numbers as transferred over. For example, suppose you have a number like 1.0243 in Excel. What too many people do is to TYPE it into MATLAB as 1.0243. The problem is, Excel actually was carrying more precision than that. It was surely not the actual number. So what happens is you did the computations in MATLAB with the wrong numbers.
Why do I think this is what you have done? Because you have reported an essentially constant error, regardless of whether you used higher precision to do the computations.
More Answers (0)
See Also
Categories
Find more on Line Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!