Graph Rat
Graph Rat
m
April 9, 2010
Page 1
10:21:01 PM
clc
clear all
disp('welcome to graph rationaler')
g1=input('grid size large (g1)=');
g2=input('grid size small (g2)=');
x1=input('upper value of x =');
x2=input('lower limit of x =');
y1=input('upper value of y =');
y2=input('lower value of y =');
diffx=x1-x2;
diffy=y1-y2;
v1=g1/diffx;
fprintf('grid side one value for x=%f\n',v1)
v2=g2/diffx;
fprintf('grid side two value for x=%f\n',v2)
v3=g1/diffy;
fprintf('grid side one value for y=%f\n',v3)
v4=g2/diffy;
fprintf('grid side two value for y=%f\n',v4)
cx=input('enter the choice for x=');
cg1=input('enter the corresponding grid side (" if long side g1 else g2")=
');
cy=input('enter the choice for y=');
clc
fprintf('your choice for x axis(per squar)=%f\n',cx)
fprintf('your choice for y axis(per squar)=%f\n',cy)
if 'cg1=g1'
cg2=g2;
else cg2=cg1;
end
fprintf('x axis falls to grid=%f\n',cg1)
fprintf('y axis falls to grid=%f\n',cg2)
if 'cg1=g1'
a1=ceil((cx*g1-diffx)/g1);
a2=ceil((cy*g1-diffy)/g1);
else a1=ceil((cx*g2-diffx)/g2);
a2=ceil((cy*g2-diffy)/g2);
end
fprintf('appr: excces squars at x axis=%f\n',a1)
fprintf('appr: excces squars at y axis=%f\n',a2)
disp('NOVA /2010')