how can we linearise?

13 views (last 30 days)
Burhan Elaldi
Burhan Elaldi on 26 Apr 2019
Linearise the given nonlinear equation and then apply linear least-squares regression to find the equation
for the regression line. Plot the linearised data set together with the regression line. Determine Sr (the sum
of squares of residuals around the regression line) and r2 (the corresponding coefficient of determination).
clc
clear all
close all
syms x y a b A B a0 a1
%given dependent and independent datas
xdata=[0.1 0.2 0.4 0.6 0.9 1.3 1.5 1.7 1.8];
ydata=[0.75 1.25 1.45 1.25 0.85 0.55 0.35 0.28 0.18];
sr=ydata-(a.*xdata.*exp(b.*xdata))
%Finding the values of Sr,St,a,b,r-square
A=diff(sr,a0);
B=diff(sr,a1);
sr=sum(ydata-(a.*xdata.*exp(b.*xdata)))
st=sum((ydata-mean(ydata)).^2);
r2=(st-sr)./st;
display(sr)
display(r2)
display(st)

Answers (0)

Categories

Find more on Linear and Nonlinear Regression in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!