In matlab, us the pseudo inverse function to create a linear fit from velocity-second matrix. Use the equation to project the speed when v=12 m/s.
v [6 8 10]
s [50 88 124]
Script file:
clear all;
clc;
n=1;
% n=order of polynomial
% given data
v=[6 8 10];
s=[50 88 124];
% after linearising
% v = a(1) + a(2)*s
X=v;
Y=s;
m=length(X);
if size(X)~=size(Y)
error('Enter X and Y in same order');
end
A=zeros(n+1,n+1);
B=zeros(n+1,1);
for i=0:n
for j=0:n
A(i+1,j+1)=sum(X.^(i+j));
B(i+1)=sum((X.^(i)).*Y);
end
end
a=A\B;
fprintf('The polynomial equation is \ns=');
fprintf('%f+%f*v\n',a(1),a(2));
fprintf('At v=12, s=%f',a(1)+a(2)*12);
Screenshot:
Save the above program and execute it.
Result:
I hope this will help you.
In matlab, us the pseudo inverse function to create a linear fit from velocity-second matrix. Use...
I need to Write a Matlab program to use Hebb rule with pseudo-inverse matrix to Distinguish between the numbers from 0 to 9 written in a matrix of 6 rows and 5 columns
MATLAB QUESTION !!! PLEASE USE MATLAB FOR BOTH
QUESTIONS!!! THANKS
3) Below is a matrix of random numbers. Find the mean, median, and mode of the matrix. B=[0 1 2 3 4 50689 23092 6 8 407] Sort Matrix Z so that the largest numbers of each row are in the first column and smallest numbers descend towards the last column. Must use sort function. 4) Create a matrix X so that the first row has values from 0 to...
what is a good matlab code to out put this matrix from
question 1 to 3
HITA 1)-The general form cf the quadratic equation is a +bx+c 0 Wrte a MATLAB function named quadratic that finds the two roots of this equation and x when given the coeficients a, b and c 2)-Create a random matrix A in MATLAB with 6 rows and 3 oolumns using the rand) function 3)-Now modify quadratic by so that il can take each row...
Using Matlab.
The following calibration data are from a hot wire anemometer (HWA) velocity measurement system for air flow: Air Velocity, V (m/s) HWA Output Voltage (E) 0.0 1.100 1. 1.1 1.362 2. 1.431 1.5 3. 1.487 2.0 4. 1.535 2.5 5. 1.576 6 3.0 1.647 4.0 7. 1.706 8. 5.0 1.780 9. 6.5 1.841 10. 8.0 1.910 10 11. 1.983 12. 13 13. 16 2.072 14. 20 2.159 15. 25 2.257 16. 32 2.379 17. 40 2.500 1. Perform...
P2) Write a MATLAB function myLinReg Username that is defined below. Use the in-built MATLAB function sum( ) to ease your programming (you are NOT allowed to use polyfit() and polyval()). Test the output of this function with the results obtained by hand for P1. Submit printout of program and a screenshot of the command window showing the results for P1. function [coeffvec, r2]-myLinReg_Username (xi,yi) %Function file: myLinReg-Username .m Purpose : 8 To obtain the parameters of a L.S. linear...
using matlab
Create the following matrix B. [18 17 16 15 14 13] 12 11 10 9 8 7 6 5 4 3 2 1 Use the matrix B to: (a) Create a six-element column vector named va that contains the elements of the second and fifth columns of B. (6) Create a seven-element column vector named vb that contains elements 3 through 6 of the third row of B and the elements of the second column of B. Create...
USE MATLAB TO SOLVE PLEASE
42. The velocity, v, of an object that falls freely due to the Earth gravity can be modeled with the equation: - mg + kv? dt where m is the mass of the object, g = 9.81 m/s2, and k is a constant. Solve the equation for v for the case that m = 5 kg, k = 0.05 kg/m, 0<t<15 s, and wo) = 0 m/s. Make a plot of v as a function...
MATLAB WORK PLEASE
The upward velocity of a rocket can be computed from the following formula: v=u* In mo -91 mo-91 where v = upward velocity, u = the velocity at which fuel is expelled relative to the rocket, me = the initial mass of the rocket at time t=0,9 = the fuel consumption rate, and g = the acceleration due to gravity. Compute the time tro at which v reaches an arbitrary value using the bisection method. Use the...
Use matlab
a) Create a simulated data set b) Create a set of plots to determine the best transformation to linearize the data c) Fit a first order polynomial (y mx + b) to the linearized data to find the constants m and b d) Reconstruct the original equation from m and b in the linear fitted polynomial e) Plot the fitted equation. Radioactive decay is modeled by the equation: rt where A the amount of mass as a function...
Question-2 The diff () command in MATLAB is only used for solving linear differentiational equations. Select one: True False Question-3 The diff () command in MATLAB can solve only up to third order differentiational equation. Select one: True False Question-4 The symbolic variable must be defined in the MATLAB to use diff (), laplace and ilaplace commands. Select one: True False Question-5 The “s” is the pre-defined symbolic variable MATLAB variable for solving inverse Laplace in MATLAB. Select one: True...