Please help me write MATLAB code to solve this problem Thank
Please help me write MATLAB code to solve this problem. Thanks!!
The variation of viscosity mu (10^-3 Ns/m^2) as a function of temperature T (degree C) of water was observed as: It was proposed that this relationship can be modeled as: mu = De^B/Ta, where D and B are coefficients and Ta is the absolute temperature in K. Fit this model to the data in order to determine the best values for the coefficients D and B. Plot the data of muvs Ta (as symbols) and the predicted function (as line), on the same graph.Solution
clc;
close all;
clear all;
x = [ 1/5.0 1/10.0 1/20.0 1/30.0 1/40.0] ; % independent variable quantities
y = [ 1.519/1000 1.311/1000 1.02/1000 .811/1000 .6529/1000] ; % dependent variable quantities
Y = log(y);
X = x;
s_X = sum(X);
s_Y = sum(Y);
s_X_2 = sum(X.^2);
s_XY = sum(X.*Y);
N = length(X) ;
B = (s_XY-(s_X_2*(s_Y/s_X)))/(s_X-(s_X_2*N/s_X)) ;
A = (s_Y - N*B)/s_X;
C = exp(B);
syms xx yy
yy = C*exp(A/xx);
figure
hold on
plot([0,5,10,20,30,40],[1.7871/1000 1.519/1000 1.311/1000 1.02/1000 .811/1000 .6529/1000],\'kh\')
ezplot(yy,[0,40])
-----------------------------------------------------------------------------------------------------------------
C and A are D and B respectively
