MATLAB program results discrepancy....

  • Context: MATLAB 
  • Thread starter Thread starter AMMforce
  • Start date Start date
  • Tags Tags
    Matlab Program
Click For Summary

Discussion Overview

The discussion revolves around discrepancies in results obtained from a MATLAB program involving matrix computations. Participants explore potential causes for the poor results despite using the same code and parameters as before, focusing on aspects such as software version, computational environment, and matrix characteristics.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant mentions using MATLAB R2011a and experiencing poor results with smaller matrices, despite previously obtaining good results with the same code.
  • Another participant suggests checking if the original matrix size yields the same results after clearing variables, indicating a potential issue with how the code interacts with different matrix sizes.
  • A third participant raises questions about changes in the MATLAB version and whether the script was originally run on R2011a, noting that functionality might differ across releases.
  • There is a mention of the impact of different computer processors on linear algebra operations, which could affect results.
  • One participant points out that switching operating systems (e.g., from Windows to macOS or Linux) could introduce issues.
  • Another participant highlights that calculations involving ill-conditioned matrices can be sensitive to small changes, suggesting that the new results might still be valid despite differences.
  • The original poster later identifies a parameter-setting issue as the root cause of the discrepancies, explaining how a change in the method of setting a parameter affected the results.

Areas of Agreement / Disagreement

Participants express various hypotheses regarding the causes of the discrepancies, but there is no consensus on a single explanation. The discussion includes multiple competing views and remains unresolved on some aspects.

Contextual Notes

The discussion highlights potential limitations related to software version changes, computational environments, and the characteristics of matrices involved in the calculations. Specific assumptions about parameter settings and their effects on results are also noted.

AMMforce
Messages
2
Reaction score
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
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.
 
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?
 
Dont forget switching from windows to macos or linux could cause issues.
 
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.
 
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   Reactions: jedishrfu
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   Reactions: kreil

Similar threads

  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
6K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 10 ·
Replies
10
Views
4K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
8
Views
4K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 2 ·
Replies
2
Views
5K
Replies
4
Views
2K