Borrar filtros
Borrar filtros

Can someone help me with my code?

3 visualizaciones (últimos 30 días)
Onur Metin Mertaslan
Onur Metin Mertaslan el 23 de Mayo de 2020
Respondida: Cris LaPierre el 20 de Dic. de 2020
clear all, clc, close all;
N=1:99;
alfa=0.05;
z=1.96;
t= 1.984; %two-tailed t critical for 95% confidence interval
N_l=(4.459595959595959e+03+4.419191919191920e+03)/2; %population lower mean
N_u=(5.833333333333333e+03+6.080808080808080e+03)/2; %population upper mean
Sample_l=[];
Sample_u=[];
gpa=[2.25,2.75,2.75,2.75,2.75,2.75,2.75,2.75,3.25,3.75,3.75,2.25,2.25,2.25,2.25,2.25,2.75,2.75,2.75,2.75,2.25,2.75,2.75,2.75,2.75,2.75,2.75,2.75,2.75,3.25,3.25,3.25,3.25,3.25,3.25,3.25,3.25,3.75,2.25,2.25,2.25,2.25,2.75,2.75,2.75,2.75,3.25,3.25,3.25,3.25,3.25,3.25,3.25,3.25,2.25,2.25,2.75,2.75,2.75,2.75,2.75,2.75,2.75,2.75,3.25,3.25,3.25,3.25,3.25,3.25,3.75,3.75,2.25,2.25,2.25,2.25,2.25,2.25,2.25,2.75,2.75,2.75,2.75,2.75,2.75,2.75,2.75,3.25,3.25,3.25,3.25,3.25,3.25,3.25,3.25,3.25,3.25,3.25,3.75];
for i=1:11
Sample_l(i)=2500;
Sample_u(i)=3500;
end;
for j=12:20
Sample_l(j)=3500;
Sample_u(j)=4000;
end;
for k=21:38
Sample_l(k)=4000;
Sample_u(k)=4500;
end;
for t=39:54
Sample_l(t)=4500;
Sample_u(t)=5000;
end;
for z=55:72
Sample_l(z)=5000;
Sample_u(z)=5500;
end;
for u=73:99
Sample_l(u)=5500;
Sample_u(u)=9000;
end;
A=sum(Sample_l)/99; %mean of the lower limit
B=sum(Sample_u)/99; %mean of the upper limit
Var_l=var(Sample_l); %var of the lower limit
Var_u=var(Sample_u); %var of the upper limit
Std_l=std(Sample_l); %Standart deviation of the lower limit
Std_u=std(Sample_u); %Standart deviation of the upper limit
Hello everyone, I am trying to find linear regration between "gpa" and "Sample_l" but I could not do it in matlab. Actually I could not understand how to do it. Is there anyone who can help me?
Thanks a lot!

Respuestas (1)

Cris LaPierre
Cris LaPierre el 20 de Dic. de 2020
There are a couple ways to do this in MATLAB. I'll go with the one that doesn't require any additional toolboxes.
You can do this with polyfit, which tries to fit a polynomial of a specified order to the X and Y data. Linear regression is just fitting a polynomial of first order ().
You can follow this example.

Categorías

Más información sobre Descriptive Statistics en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by