0% found this document useful (0 votes)
42 views6 pages

Technological Institute of The Philippines: 938 Aurora Boulevard, Cubao, Quezon City

1. The document is a midterm quiz in MatLab programming submitted by Ana Marie N. Dazo to her professor Engr. Rogelio Delgado, Jr. 2. It contains sample data on LDL cholesterol and blood sugar levels for 7 patients and the codes to analyze the data and determine the mean, linear regression equation parameters (a0, a1), and correlation coefficient (r). 3. The codes calculate the mean LDL and blood sugar levels, generate a scatter plot with linear regression line, and print the required outputs in red font color as specified.

Uploaded by

ananananymous
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views6 pages

Technological Institute of The Philippines: 938 Aurora Boulevard, Cubao, Quezon City

1. The document is a midterm quiz in MatLab programming submitted by Ana Marie N. Dazo to her professor Engr. Rogelio Delgado, Jr. 2. It contains sample data on LDL cholesterol and blood sugar levels for 7 patients and the codes to analyze the data and determine the mean, linear regression equation parameters (a0, a1), and correlation coefficient (r). 3. The codes calculate the mean LDL and blood sugar levels, generate a scatter plot with linear regression line, and print the required outputs in red font color as specified.

Uploaded by

ananananymous
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

TECHNOLOGICAL INSTITUTE OF THE PHILIPPINES

938 AURORA BOULEVARD, CUBAO, QUEZON CITY

ELECTRONICS ENGINEERING DEPARTMENT

Midterm Quiz No. 1 in MatLab Programming

Rating

Submitted by:
Dazo, Ana Marie N.
EC21FA2

Submitted to:
Engr. Rogelio Delgado, Jr.

The following are the answers that should appear in your program. When you copy paste using word, the following
answers should be in RED FONT COLOR. If you do not follow the instruction, you will get 0.

1.
2.
3.
4.
5.

DAY

Mean of LDL Cholesterol Level:


Mean of Blood Sugar Level:
Value of a0:
Value of a1:
Value of r:

126.8414
122.4143
122.0076
0.0032
8.3374

LDL CHOLESTEROL LEVEL,


mg/dL

BLOOD SUGAR
LEVEL, mg/dL

x 2i

133.25
116.10
118.20
121.33
119.25
142.12
137.64

118.10
121.44
115.16
121.10
133.75
124.25
123.10

1.7756
1.3479
1.3971
1.4721
1.4221
2.0198
1.8945

xi yi
1.0e+04*

1
2
3
4
5
6
7

1.5737
1.4099
1.3612
1.4693
1.5950
1.7658
1.6943

CODES:
>> d1= [133.25 118.10];
>> d2=[116.10 121.44];
>> d3=[118.20 115.16];
>> d4=[121.33 121.10];
>> d5=[119.25 133.75];
>> d6=[142.12 124.25];
>> d7=[137.64 123.10];
>> mean=(d1+d2+d3+d4+d5+d6+d7)/7
mean =
126.8414 122.4143
>> xm=126.8414;
>> ym=122.4143;
>> x=[133.25 116.10 118.20 121.33 119.25 142.12 137.64];
>> y=[118.10 121.44 115.16 121.10 133.75 124.25 123.10];
>> x2=x.^2;
>> xy=x.*y;
>> sxy=sum(xy);
>> sx=sum(x);
>>sy=sum(y);
>>sx2=sum(x2);
>> sxx2=sx^2;
>> y2=y.^2;
>> sy2=sum(y2);
>> syy2=sy^2;
>> d=[d1;d2;d3;d4;d5;d6;d7];
>> table=[d x2' xy']
table =
1.0e+04 *
0.0133
0.0116
0.0118
0.0121
0.0119
0.0142
0.0138

0.0118
0.0121
0.0115
0.0121
0.0134
0.0124
0.0123

1.7756
1.3479
1.3971
1.4721
1.4221
2.0198
1.8945

1.5737
1.4099
1.3612
1.4693
1.5950
1.7658
1.6943

>> a1=(7*sxy-(sx*sy))/(7*sx2-(sxx2))
a1 =
0.0032

>> ao=ym-a1*xm
ao =
122.0076
>> r=(7*sxy-(sx*sy))/sqrt((7*sx2)-sxx2)*sqrt((7*sy2)-syy2)
r=
8.3374
>> plot(x,y,'mo',x,yy,'co')
>> title 'Relationship of LDL Cholesterol Level and Blood Sugar Level'
>> xlabel 'Cholesterol Level, mg/dL'
>> ylabel 'Blood Sugar Level, mg/dL'
>> grid on
>> plot(x,y,'mo',x,yy,'c.')
>> title 'Relationship of LDL Cholesterol Level and Blood Sugar Level'
>> xlabel 'Cholesterol Level, mg/dL'
>> ylabel 'Blood Sugar Level, mg/dL'
>> grid on
>> legend('Cholesterol vs Blood sugar','Equation of the Line')

You might also like