4_Quarterman_Patrick_HW11A

4_Quarterman_Patrick_HW11A - %calculate the distortion of...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Patrick Quarterman Section 4 HW11A Part 1: %'script' HW11A part 1 %Patrick Quarterman, Section 4 %convert spherical coordinates into cartesian and plot sub location %input: sub coordinates in spherical and angles in degrees %output: figure of sublocation in cartesian %given spherical coordinates r = [35.1 33.6 31.2 29.8 30.1 32.0 28.8 26.9 25.4 23.6 21.3 19.7 22.3 24.7]; theta = [1.4 1.38 1.35 1.2 0.99 0.93 0.78 0.63 0.5 0.4 0.3 0.2 0.1 0]; phi = [53.3 60.8 69.5 79.4 90.0 100.6 103.7 112.0 120.3 128.3 135.6 141.5 144.9 145]; %convert to rectangular coordinates x= r.*cosd(theta).*cosd(phi); y=r.*cosd(theta).*sind(phi); z=r.*sind(theta); %plot coordinates in 3D plot3(x,y,z) title( 'Sub Location' ) xlabel( 'X (mi)' ) ylabel( 'Y (mi)' ) zlabel( 'Depth (mi)' ) grid on -40 -20 0 20 40 10 20 30 40 0 0.2 0.4 0.6 0.8 1 X (mi) Sub Location Y (mi) Depth (mi)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Part 2: function [] = distortionplot(X,Y) %Patrick Quarterman, Section 4
Background image of page 2
Background image of page 3
This is the end of the preview. Sign up to access the rest of the 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.

Page1 / 3

4_Quarterman_Patrick_HW11A - %calculate the distortion of...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online