how can we linearise?

조회 수: 19 (최근 30일)
Burhan Elaldi
Burhan Elaldi 2019년 4월 26일
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)

답변 (0개)

카테고리

Help CenterFile Exchange에서 Linear and Nonlinear Regression에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by