Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: not showing any result when i use while.
Replies: 1   Last Post: Oct 25, 2012 3:40 PM

 Messages: [ Previous | Next ]
 srishti Posts: 12 Registered: 9/15/12
not showing any result when i use while.
Posted: Oct 25, 2012 3:16 PM

SD = 1;
while SD > 1
h=x;
% maximum envelope
maxi=[];
mapo=[];
for i=1:250:200000;
[c,d]=max(h(i:i+249));
maxi=[maxi,c];
mapo=[mapo,d+(i-1)];
end
yy =spline(mapo,maxi,1:200000);
plot(mapo,maxi,'o',1:200000,yy);
% minimum envelope
mini=[];
mipo=[];
for i=1:250:200000;
[d,f]=min(h(i:i+249));
mini=[mini,d];
mipo=[mipo,f+(i-1)];
end
yy1=spline(mipo,mini,1:200000);
figure,plot(mipo,mini,'o',1:200000,yy1);
m=(yy+yy1)/2;
prevh=h;
h=h(1:200000)-m
SD =sum ( ((prevh(1:200000) - h).^2) ./ (prevh(1:200000 ).^2) );
end

If I run this code with in while condition then it does not shows the value of YY and yy1,h. But if I run it without while then shows the value of yy,yy1,h,sd.........I am not getting the problem.Can anybody help me out in this?

Date Subject Author
10/25/12 srishti
10/25/12 Steven Lord