{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

orbit - end A =[ones(size(r-r*cos(theta x =(A*A(A*r p = x(1...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
function [p,e] = orbit (r, theta) %ORBIT(R,THETA) returns the values p and e for the equation of a heliocentric orbit %[p,e] = orbit (r, theta) uses the least squares method to find the best %approximate p and e for heliocentric orbit of measured r and theta values. if length(r) ~= length(theta) error('Please input an r and theta of the same length')
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: end A = [ones(size(r)) -r.*cos(theta)]; x = (A'*A)\(A'*r); p = x(1); e = x(2); t = linspace(0,2*pi,100); polar(t,p./(1+e*cos(t))); hold on polar(theta,r,'ro'); hold off end % r=A(:,1); % theta=A(:,2); % [p,e]=orbit(r,theta) % % p = % % 2.4560 % % % e = % % 0.3355...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online