Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
4c
4c
  • Loading branch information
tjc14008 committed Oct 6, 2017
1 parent bce0e3e commit 5ee46c6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Expand Up @@ -85,3 +85,16 @@ fx = 1.0e+04
ea = 8.6968e-05
iter = 27
```
c)
```matlab
function SSE = sse_of_parabola(K,xdata,ydata)
% calculate the sum of squares error for a parabola given a function, func, and xdata and ydata
% output is SSE=sum of squares error
K1=K(1);
K2=K(2);
y_function = K1*xdata+1/2*K2*xdata.^2;
SSE = sum((ydata-y_function).^2);
end
```

d)
8 changes: 8 additions & 0 deletions sse_of_parabola.m
@@ -0,0 +1,8 @@
function SSE = sse_of_parabola(K,xdata,ydata)
% calculate the sum of squares error for a parabola given a function, func, and xdata and ydata
% output is SSE=sum of squares error
K1=K(1);
K2=K(2);
y_function = K1*xdata+1/2*K2*xdata.^2;
SSE = sum((ydata-y_function).^2);
end

0 comments on commit 5ee46c6

Please sign in to comment.