To determine the coefficient correlation for multiple series of data with four variables
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Sheikh Khaleduzzaman
am 13 Nov. 2023
Kommentiert: Sheikh Khaleduzzaman
am 13 Nov. 2023
I have the follwoing three sets of data with four data varialbes from experiment work. where Ta, Tw and Tw2 are indepedent variables and p is dependent varialbes.
Ta = [25.25,25.6,24.67,24.03,23.87; 21.89,21.26,21.18,21.29,21.33; 20.42,20.36,20.47,20.47,20.17];
Tw = [29,31,33,36,38; 31,34,36,38,40; 32,34,36,38,40];
Tw2 = [841,961,1089,1296,1444; 961,1156,1296,1444,1600; 1024,1156,1296,1444,1600];
p = [0.46, 0.49, 0.51, 0.55, 0.57; 0.50, 0.53,0.55,0.56,0.60; 0.51,0.54,0.56,0.58,0.61];
i like to determine a single set of coeeficient correlation results out of these data based on following equation.
p = p0 + p1 (Tw) + p2 (Tw2) + p3 (Ta)
here need to determine a singel set of results for p0, p1, p2, p3.
Thank you.
0 Kommentare
Akzeptierte Antwort
atharva
am 13 Nov. 2023
Hey Sheikh Khaleduzzaman,
I understand that you need to determine a singel set of results for p0, p1, p2, p3.
you can try running the following Matlab code-
% Given data
Ta = [25.25, 25.6, 24.67, 24.03, 23.87; 21.89, 21.26, 21.18, 21.29, 21.33; 20.42, 20.36, 20.47, 20.47, 20.17];
Tw = [29, 31, 33, 36, 38; 31, 34, 36, 38, 40; 32, 34, 36, 38, 40];
Tw2 = [841, 961, 1089, 1296, 1444; 961, 1156, 1296, 1444, 1600; 1024, 1156, 1296, 1444, 1600];
p = [0.46, 0.49, 0.51, 0.55, 0.57; 0.50, 0.53, 0.55, 0.56, 0.60; 0.51, 0.54, 0.56, 0.58, 0.61];
% Reshape matrices to vectors
Ta = reshape(Ta, [], 1);
Tw = reshape(Tw, [], 1);
Tw2 = reshape(Tw2, [], 1);
p = reshape(p, [], 1);
% Create the design matrix
X = [ones(size(Ta)), Tw, Tw2, Ta];
% Fit a linear model
coefficients = X\p;
% Extract coefficients
p0 = coefficients(1);
p1 = coefficients(2);
p2 = coefficients(3);
p3 = coefficients(4);
% Display the results
disp(['p0: ', num2str(p0)]);
disp(['p1: ', num2str(p1)]);
disp(['p2: ', num2str(p2)]);
disp(['p3: ', num2str(p3)]);
This script reshapes the matrices into vectors and creates a design matrix X with columns for the constant term, Tw, Tw2, and Ta. The backslash operator (\) is then used to solve the linear system and obtain the coefficients.
Finally, the results are displayed.
I hope this helps!
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Denoising and Compression finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!