function[] = C002v2_2()
start = 0;
fin = 200;
n = 100;
div = (fin - start)/n;
c1 = [1.5, -2.5, 0.7, -1.2];
e = 0.01;
x = start:div:fin;
y = x;
for i = 1:n
y(i) = c1(1) + c1(2) * x(i) + c1(3) * x(i)^2 + c1(4) * x(i)^3 + e * randn();
end
v = zeros(4,1);
for k = 1:4
for i = 1:n
v(k) = v(k) + y(i)*x(i)^k;
end
end
A = zeros(4, 3);
for k = 1:4
for i = 1:3
for j = 1:n
A(k,i) = A(k,i) + x(j)^(i+k);
end
end
end
%A
%v
c2 = A \ v;
%c2
yf = c2(1) + c2(2) * x + c2(3) * x.^2 + c2(4) * x.^3;
f = figure();
plot(x, y, x, yf);
end
Last reply 1 day ago
Is MathsFM French Alevels good for a CS degree at top uni (OX, UCL, Durham etc)Last reply 3 days ago
OCR A-level Computer Science Paper 1 (H446/01) - 12th June 2023 [Exam Chat]Last reply 2 weeks ago
OCR A-level Computer Science Paper 2 (H446/02) - 19th June 2023 [Exam Chat]Last reply 3 weeks ago
AQA A-level Computer Science Paper 1 (7517 1A - 1E) - 12th June 2023 [Exam Chat]Last reply 1 month ago
Not receiving any response from University of Birmingham.Last reply 3 months ago
OCR GCSE Computer Science Paper 1 (J277/01) - 19th May 2023 [Exam Chat]Last reply 3 months ago
AQA GCSE Computer Science Paper 2 (8525/2) - 25th May 2023 [Exam Chat]Last reply 1 day ago
Is MathsFM French Alevels good for a CS degree at top uni (OX, UCL, Durham etc)Last reply 3 days ago
OCR A-level Computer Science Paper 1 (H446/01) - 12th June 2023 [Exam Chat]Last reply 2 weeks ago
OCR A-level Computer Science Paper 2 (H446/02) - 19th June 2023 [Exam Chat]Last reply 3 weeks ago
AQA A-level Computer Science Paper 1 (7517 1A - 1E) - 12th June 2023 [Exam Chat]Last reply 1 month ago
Not receiving any response from University of Birmingham.Last reply 3 months ago
OCR GCSE Computer Science Paper 1 (J277/01) - 19th May 2023 [Exam Chat]Last reply 3 months ago
AQA GCSE Computer Science Paper 2 (8525/2) - 25th May 2023 [Exam Chat]