Skip to content

Instantly share code, notes, and snippets.

@Kreijstal
Last active August 29, 2015 14:17
Show Gist options
  • Save Kreijstal/5f5c116ecd8803d49bcd to your computer and use it in GitHub Desktop.
Save Kreijstal/5f5c116ecd8803d49bcd to your computer and use it in GitHub Desktop.
m=0:32
x=0:48
function x= pot(x)
x=(-x/4)+8;
end
function x=ric(x)
x=(-x/2)+24;
end
plot(m,pot(m),x,ric(x));
n=0;
i=0;
p=[];
t=[];
while isempty(p)||p(end)>0
y=[];
for i=0:(n)
display(strcat('i= ',num2str(i),'n= ',num2str(n),' | ',num2str(-(i+1)/4+8),' and +',num2str(-(n-(i+1))/2+24)));
if ((-(i)/4+8)<0)
continue
end
if (-(n-(i))/2+24)<0
continue
end
y=[y,((-i/4)+8+(-(n-i)/2)+24)];
end
n=n+1;
p=[p,max(y)];
t=[t,min(y)];
end
siiize=size(p);
plot(0:siiize(2)-1,p,0:siiize(2)-1,t);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment