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 : Differences between logical and

    What are the differences between logical and physical address spaces?

  • Q : Describe Throw an exception Throw an

    Throw an exception: Whenever an exceptional circumstance occurs in a program - frequently as an outcome of a logical error and exception object is formed and thrown. When the exception is not caught by an exception handler, the program will finish wit

  • Q : Define the term Return value Define the

    Define the term Return value: This is the value of the expression employed in a return statement.

  • Q : Explain Twos-complement notation

    Twos-complement notation: In twos-complement notation, the most noteworthy bit in an integer value is employed as the sign bit. A 1 bit points out a negative number, and a 0 bit points out a positive number. The positive number can be transformed to i

  • Q : How authorities save their Private Keys

    How do certifying authorities save their Private Keys?

  • Q : Explain a way to install JAVA S60 device

    What should I do when installation fails whilst trying to install a Java™ Verified application to a certain S60 device?

  • Q : Explain Counters Counter variables are

    Counter variables are commonly used in many computer applications for different purposes. Here is a typical example where a variable is used to measures the progress of some activity of interest:

    Q : What is an Argument Argument : It is

    Argument: It is the information passed to a method. Arguments are as well sometimes termed as parameters. The method expecting to receive arguments should contain a formal argument declaration for each as portion of its method header. Whenever a metho

  • Q : Describe Real number Real number : It

    Real number: It is a number with an integer and a fractional portion. The primitive types double and float are employed to symbolize real numbers.

  • Q : Use the Alice Program Use the Alice

    Use the Alice Program from the link below to complete and save the five projects . http://alice.org/ (should be Alice 2.2 or newer) Assignment 1

    Discover Q & A

    Leading Solution Library
    Avail More Than 1449238 Solved problems, classrooms assignments, textbook's solutions, for quick Downloads
    No hassle, Instant Access
    Start Discovering

    18,76,764

    1922738
    Asked

    3,689

    Active Tutors

    1449238

    Questions
    Answered

    Start Excelling in your courses, Ask an Expert and get answers for your homework and assignments!!

    Submit Assignment

    ©TutorsGlobe All rights reserved 2022-2023.