Problem on Vectors

Create a vector representing x coordinates of a measurement with 20 points between 0 and 10. Create another vector y representing fake measurements which are related to the above x values as y = 2.3 x – 1.2. Next add random (normal, Gaussian) noise to the vector y. Plot on the same graph both versions of vector y in different colors. Next use attached linregr.m function to find a least square fit (linear regression) for your fake experimental data.

E

Expert

Verified

Calculations:

x=0:0.5:10;

y = 2.3*x - 1.2;

x1=x.^2;

xvar=mean(x1)-((mean(x)).^2);

xstd=sqrt(xvar);

noise= 1/(sqrt(2*pi*xstd))*exp(-((x-mean(x)).^2)/(2*xvar));

y1=y+noise

plot(x,y,x,y1,'g');

legend('Normal Y vector','Noise additive Y vector');

XLABEL('x')

YLABEL('Normal Y vector=2.3*x-1.2')

[a, r2]= linregr(x,y);


Results:

502_2013a.jpg


Least square fit Results gives the Least regression for the fake experimental results a = vector of slope, a(1)- → 2.3, and intercept a(2)-→ -1.2
r2 = coefficient of determination = 1

 

2061_2013b.jpg

   Related Questions in Programming Languages

  • Q : Define Assembler Assembler : The

    Assembler: The program employed to translate a program which is written in assembly language into the binary form of a specific instruction set.

  • Q : Property Specifications of Java

    Property Specifications: The most straightforward way to specify and check simple safety properties in JPF is to use Java assertions inside the application under analysis. This allows the specification of properties that only depend on the application

  • Q : Define Reserved word Reserved word : It

    Reserved word: It is a word reserved for a particular purpose in Java, like: class, int, public, and so forth. These words might not be employed as ordinary identifiers.

  • Q : How can you highlight several goodies

    How can you highlight several goodies or addons the Orbeon?

  • Q : What is testing What is testing?

    What is testing?

  • Q : Search and Coverage of SPIN Search and

    Search and Coverage of SPIN: SPIN has a highly optimized state exploration algorithm. It supports random, interactive and guided simulation, and both exhaustive and partial coverage, based on either depth-first or breadth-first search.

    Q : Image reconstruction in CT using MATLAB

    What is Image reconstruction in CT using MATLAB?

  • Q : Differences between logical and

    What are the differences between logical and physical address spaces?

  • Q : Define Octal Octal : Number

    Octal: Number representation of octal is base 8. In base 8, simply the digits 0 to 7 are employed. Digit positions symbolize successive powers of 8.

  • Q : What is Timeslice Timeslice : It is the

    Timeslice: It is the amount of running time assigned to a process or thread prior to the scheduler considers the other to be run. The process or thread will not be capable to employ its full allocation of time when it becomes blocked or preempted thro

©TutorsGlobe All rights reserved 2022-2023.