MATLAB program results discrepancy....

In summary, it seems that when the value of delta is set to a value that is not a multiple of 1e-7, the results of the function f are not correct.
  • #1
AMMforce
2
1
Hi,

I'm using MATLAB R2011a in my project, involving matrices of dimensions up to (70 × 20). I had good results, a time ago. Currently, poor results are generated using the very same code -(of good results)- with same parameters settings & relatively smaller matrices (30 × 20) !
I tried:

1. before running my code, at command line:

clear import;
pack;

2. inside my script, at the very beginning:

clear all; clear classes; clear java;
clearvars;
close all;
clc;

3. running the same code, on two different computers (that I was using).

Unfortunately, I ended up with the same poor results. It looks like the extensively repeatative code run (through my experiments), did some bad accumulation effect !
Other than clearing memory & variables space, is there another aspect/issue that needs my attention? Appreciate your advice/help.BR/
AMMforce
 
Physics news on Phys.org
  • #2
Welcome to PF!

Not much we can say without seeing your code. However, having said that I have one question:

Have you tried doing what you did to clear things and then running it with the original size for your matrices?

If you get the same results as before then it may have something to do with how your code works with the reduced matrices.
 
  • #3
There are a number of possibilities for why the results would be different, and as jedishrfu said it's hard to say much without seeing the code.

That said, you just need to ask yourself what has changed:

1. Was the script originally written and run using R2011a? Are you using that same release of MATLAB? If not, some of the functionality might have changed between releases. To investigate, check the release notes for the versions of MATLAB in between: http://www.mathworks.com/help/matlab/release-notes.html

2. Are you using a new computer? If so, sometimes the exact processor that is used can affect the results of linear algebra operations.

3. What validation techniques are you using to confirm good and bad results?
 
  • #4
Dont forget switching from windows to macos or linux could cause issues.
 
  • #5
Calculations involving ill-conditioned matrices can be very sensitive to tiny changes. The new results may be just as valid as the original results even if they are very different. You may want to take a look at the characteristics of the matrices involved. Look for a large ratio of largest to smallest eigenvalue.
 
  • #6
kreil, jedishrfu, and FactChecker:
Deeply appreciate your help & responses.I've just spotted the root cause (after about 12 days of investigation... :frown:), and resolved the issue :smile:.
I'd like to share it with you and all viewers here:

Part of my computations, involves a parameter. Before, this parameter was set manually to a given number of certain factor (say: delta = 0.3 * 1e-7).
I had changed the way of setting this parameter to be computed using two other parameters "par1 & par2" as follows:

delta = f(par1, par2) * 1e-7; where "f" denotes a function.

"par1" is aleady set to a fixed value with the same factor (say: par1 = 0.002 * 1e-7). Hence, delta facor changed to a value < 1e-7 !
Both delta & par1 must be of the same factor (in our example: 1e-7). So, omitting the factor "1e-7" from delta formula:

delta = f(par1, par2);

fixed the issue, and results were obtained as expected.Cheers!
 
  • Like
Likes jedishrfu
  • #7
The wonders of programming a little change here and nothing happens, a little change there and everything breaks and the world will never be the same.
 
  • Like
Likes kreil

FAQ: MATLAB program results discrepancy....

What is MATLAB program results discrepancy?

MATLAB program results discrepancy refers to the difference between the expected results and the actual results obtained from running a MATLAB program. This can be caused by various factors such as programming errors, numerical precision, or incorrect input values.

How can I troubleshoot MATLAB program results discrepancy?

To troubleshoot MATLAB program results discrepancy, you can start by checking for any programming errors or incorrect input values. You can also try adjusting the numerical precision settings or using different algorithms or functions to see if it affects the results. Additionally, checking for any known bugs or issues with the specific version of MATLAB you are using can also help in troubleshooting.

What should I do if I encounter MATLAB program results discrepancy?

If you encounter MATLAB program results discrepancy, you should first carefully review your code and input values to check for any errors. If you are unable to identify the issue, you can seek help from MATLAB's online community or contact MathWorks support for assistance. It is also recommended to keep your MATLAB software updated to the latest version to avoid any known issues.

Can external factors affect MATLAB program results discrepancy?

Yes, external factors such as hardware limitations, operating system differences, or changes in the input data can also affect MATLAB program results discrepancy. It is important to consider these factors and make necessary adjustments to ensure accurate results.

How can I prevent MATLAB program results discrepancy in the future?

To prevent MATLAB program results discrepancy in the future, it is important to thoroughly test and debug your code before running it. You can also use validation techniques such as comparing results with known values or using multiple methods to verify the accuracy of the results. It is also recommended to document your code and input values to make it easier to troubleshoot in case of any discrepancies.

Similar threads

Replies
10
Views
2K
Replies
4
Views
1K
Replies
5
Views
1K
Replies
4
Views
2K
Replies
2
Views
4K
Back
Top