Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

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)
 

zorro

Advanced Member level 4
Joined
Sep 6, 2001
Messages
1,131
Helped
356
Reputation
710
Reaction score
298
Trophy points
1,363
Location
Argentina
Activity points
8,902
Hi Zapak,

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

Z
 

RDRyan

Full Member level 2
Joined
May 24, 2007
Messages
133
Helped
20
Reputation
40
Reaction score
3
Trophy points
1,298
Location
China
Activity points
1,976
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
 

machael

Member level 2
Joined
Nov 4, 2004
Messages
49
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
513
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.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top