Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
How to Get Rid of Orange Warnings

Subject: How to Get Rid of Orange Warnings

From: Matlab-Challenged Miller

Date: 18 Mar, 2010 23:55:06

Message: 1 of 3

I ran this exact code earlier this week and it took awhile, but it finally worked. Now when I try and run it, it gives me an error. Can anyone figure out what would be going wrong? Thankss!

clear
clc
theta1=.3;
k=18.4;
alpha=k/1703703.704;
N=.5;
for h=50:90;
    for j=100:500;
        for LR= 100:250;
            for l= 1:150;
                L=l*.01;
                V=.0001*j;
                a1=(V*L)/alpha;
                a0=((2*h*L)/k)*(LR);
                lmda1=(a1 + (sqrt((a1^2)+4*a0)))/2;
                lmda2=(a1 - (sqrt((a1^2)+4*a0)))/2;
                c1=(theta1-exp(lmda2))/(exp(lmda1)-exp(lmda2));
                c2=1-c1;
                theta=c1*exp(lmda1*N)+c2*exp(lmda2*N);
                if abs(.556 - theta)<0.001
                    disp('V LR h L')
                    H=[V LR h L]
                    disp('a1 a0')
                    Q= [a1 a0]
                end
            end
        end
    end
end

Subject: How to Get Rid of Orange Warnings

From: ImageAnalyst

Date: 19 Mar, 2010 01:15:03

Message: 2 of 3

I ran it and it seemed to run, but it ran for a few minutes and I
finally aborted it because it was taking too long. What, exactly, is
the error?

If you don't want the orange warnings, you can hover your cursor over
the offending line, and right click and tell it to suppress that
warning.

Subject: How to Get Rid of Orange Warnings

From: Roger Stafford

Date: 19 Mar, 2010 04:13:05

Message: 3 of 3

"Matlab-Challenged Miller" <sportsjane@comcast.net> wrote in message <hnuegq$36q$1@fred.mathworks.com>...
> I ran this exact code earlier this week and it took awhile, but it finally worked. Now when I try and run it, it gives me an error. Can anyone figure out what would be going wrong? Thankss!
> .........

  Your warnings are probably due to the way you attempt to display on the screen all the cases where abs(.556-theta)<0.001 is true using the four lines:

 disp('V LR h L')
 H=[V LR h L]
 disp('a1 a0')
 Q= [a1 a0]

There are much more efficient ways of outputting such data on the screen using, say, fprintf. You could probably squeeze each case into one line rather than the twelve you utilize here. However, there appear to be many millions of cases where this condition comes true in your code. Matlab is very likely telling you it objects to having its screen memory buffers filled up with so much voluminous data. How are you going to deal with that many displayed results, even using fprintf? You will never have time to read them in their entirety, even supposing that Matlab were to save them all.

  I would suggest you store whatever results you want to save in certain arrays and study these arrays later at your leisure in some more efficient manner with other matlab code than trying to look at each case. You surely don't want to have to individually read many millions of figures. Either that or greatly tighten up your 0.001 tolerance in the above inequality so as to produce many fewer results.

  As for execution time, there are a number of inefficiencies in the code. It makes no sense to compute exp(lmda2) and sqrt((a1^2)+4*a0)) each twice at each pass rather than just once. In the for-loops for j and l, you can use V and L directly and avoid the following two lines altogether:

 L=l*.01;
 V=.0001*j;

Just say "for V = .01:.0001:.05" and "for L = .01:.01:1.5". Also you might be able to save time by vectorizing the code to avoid the four nested for-loops altogether, although that is not certain.

Roger Stafford

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us