Problem in Matlab M-file programming

Status
Not open for further replies.

zapak

Junior Member level 2
Joined
Feb 9, 2007
Messages
20
Helped
3
Reputation
6
Reaction score
0
Trophy points
1,281
Location
Nepal
Activity points
1,433
Hi! I have a small project requiring programming in MATLAB. While debugging, I noticed that for some reason, this software does not calculate the division of complex numbers very accurately. Because of this, there was a considerable difference in the answers calculated manually using a calculator and those produced by the program. As far as the correctness of the syntax is concerned, I'm pretty sure I've cleaned up all the mistakes after going through the codes countless number of times.

So, anyway! My question is : what is causing this inaccurate calculation of the division of complex numbers in m-file programs? Also, is there any way to improve the accuracy?(just like converting to a better solver as in case of Simulink)
 

Hi Zapak,

that is strange for me.
Have you an example that shows the inaccuracy you speak about?
Regards

Z
 

As the help of matlab says: All the computations in MATLAB are done in double precision.
So maybe you should change the accurate of the output. use command such as 'format long' or 'format long g', etc.


Ryan
 

zorro is right, zapak you should post the example and illustrate your problem. so far, I haven't found matlab has such problem
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…