This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: %calculate the distortion of an image %input: x and y values %output: 3D distortion plot and calculate distortion for X and Y %create vectors x and y x=linspace(-10,10,21); y=linspace(-15,15,31); %create an array of values for d with x changing in columns and y in rows for i=1:length(y) for j=1:length(x) d(i,j)=(.5*x(j)^3+1/3*y(i)^3)*exp(.001*x(j)^2)*exp(.001*y(i)^2); end end %calculate the distortion at coordinates X, Y D=(.5*X^3+1/3*Y^3)*exp(.001*X^2)*exp(.001*Y^2); %create a surface plot of the distortion from values found from array in %for loop surf(x,y,d) title( 'Distortion' ) xlabel( 'X' ) ylabel( 'Y' ) zlabel( 'Distortion' ) hold on %add on the same plot the value for D plot3(X,Y,D, '.' , 'MarkerSize' ,20) hold off-10-5 5 10-20-10 10 20-3000-2000-1000 1000 2000 3000 X Distortion Y Distortion...
View Full Document
This note was uploaded on 11/16/2010 for the course EGR 102 taught by Professor Hinds during the Spring '09 term at Michigan State University.
- Spring '09