Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am trying to find the least squares fit for a set of data that is suppose to f

ID: 3079899 • Letter: I

Question

I am trying to find the least squares fit for a set of data that is suppose to fit the polar equation below: 2?? (1 + ?? ????????) = ?? which can then be written as: 2?? = ?? (?2?? ????????) + ?? So ??k = 2??k and ??k = ?2??k ????????k. I have already input the data into the script file: clear all; close all; clc; r=[42895,42911,42851,42779,42774,42764,42750,42744,42749,42749,42894]; theta=[-0.1289,-0.1352,-0.1088,-0.0632,-0.0587,-0.0484,-0.0280,-0.0085,0.0259,0.0264,0.1282]; [m b]=mylinfit(-2*transpose(r)*cos(theta),2*r); q=[m,b]; esval=polyval(q,-2*transpose(r)*cos(theta)); plot(-2*transpose(r)*cos(theta),2*r,'o',-2*transpose(r)*cos(theta),esval,'-') xlabel('Xk'); ylabel('Yk'); title('Least Squares Linear Fit k=1-13'); I am also using the following function to find the least squares fit function [m,b] = mylinfit(x,y) n=length(x); numerator_slope= n*sum(x.*y)-sum(x)*sum(y); denominator_glob=n*sum(x.^2)-(sum(x))^2; m=numerator_slope/denominator_glob; numerator_int= (sum(x.^2))*sum(y)-sum(x)*sum(x.*y); b=numerator_int/denominator_glob; end For some reason the least square line is way off. Can someone please check my script file and see any issues? Thanks!

Explanation / Answer

what are the boxes sorry the qestion was not understandable

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote