10.) Write a MATLAB script that will use the Pressure and Temperature columns from the provided Excel file imported previously. Use polyfit to create a linear best fit line. Calculate the R2 value for fit. Plot both the individual data points (red) and the fit line (blue) on the same graph. Include a title and axis labels.
clc
clear all
close all
format long
P=[1,5,10,15,20:5:50];
T=[300,315,330,345,360,375,390,405,420,435,450];
C=polyfit(P,T,1);
fprintf('Best fit line is T=%f*x+%f\n',C);
xx=0:0.01:50;
plot(xx,polyval(C,xx),'b',P,T,'or');
xlabel('X');
xlabel('Y');
title('Plot of f and fit');
SST=sum((T-mean(T)).^2);
SSR=sum((T-polyval(C,P)).^2);
R2=1-SSR/SST

10.) Write a MATLAB script that will use the Pressure and Temperature columns from the provided...
Using MatLab what would be the script for problem 4 given that
question4.xlsx is the chart in the second picture. I know how to
upload it and find the length but when I try to do the graph no
graph is showing up after I run the script.
4. The excel file attached to this homework titled "question4.xlsx" contains data from a certain experiment. Column 1 shows the experimental value and column 2 shows the expected value. a. Open this...
I need help with these two Matlab question (1)Write a script that will 1. prompt the user for a maximum x value. 2. create an x vector from 1 to the user’s maximum in steps of 0.1 3. create a y vector which is sin(x) 4. plot the x and y vectors using blue *s, using appropriate x and y labels and a title (2)Write a fives function that will receive two arguments for the number of rows and columns...
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...
LA Variables - TempPress 1 TempPress X # 34x16 table 10 13 16 VarName4 VarName7 VarName8 11 VarName11 12 VarName 12 VarName 16 1 Energy) VarName3 NaN NaN" Heightm1 NaN NaN Energy)1 NaN NaN Heightm2 NaN NaN Energy)2 NaN NaN 0 0 0" 0- ino 00 Heightm NaN NaN 0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 49.0500 98.1000 147.1500 196.2000 - 245.2500" 294.3000 343.3500 392.4000 441.4500 490.5000 539.5500 588.6000 - 637.6500"...
two functions. The first plot on the left is y = 1 − e(−0.5sqrt(x) and the second plot on the right is y = e(−0.5sqrt(x) . Let x be from 0 to 10 with increment 0.1. The first plot is in blue color, solid line and the second is in red color, dotted line. Turn both grids on. Both figures should have own title and x-axis and “y-axis” labels. Note that you should plot both according to the above instruction....
using matlab
3. Write a script that will read the ages vector.dat file created in the previous problem. - the script will print the number of persons in the group - the script will print the maximum and minimum ages in the group - the script will compute and print the "average age" The script should return something like: The file contains the ages of a group of 50 people The maximum and minimum ages in the group are 10...
A group of physics students collected data from a test of the projectile motion problem that was analyzed in a previous lab exercise (L5). In their test, the students varied the angle and initial velocity Vo at which the projectile was launched, and then measured the resulting time of flight (tright). Note that tright was the dependent variable, while and Vo were independent variables. The results are listed below. (degrees) Time of Flight (s) Initial Velocity V. (m/s) 15 20...
Using MATLAB. Create a script file that calls a user-defined function within a for/end loop to symbolically compute the derivative of ln(x) on the interval from -5 to 5, containing 100 data points. Your script file should output a plot of the derivative of ln(x) (taken from your function) vs x. Use a line with circular markers for the plot and include a grid and appropriate labels. The user-defined function should 1. Receive a single x value as input. 2....
Matlab
5. (10 pts) The following table shows data from a chemical reactor as a reaction is taking place. The concentration of the reactant is monitored as a function of time. 10 20 30 40 50 60 70 80 90 100 Time (s) Concentration (mg/L) 100 36.8 135 5 18 17 1.6 1.5 1.4 1.3 1.2 write a MATLAB script to generate a plot of concentration (y-axis) vs. time (x-axis). Use a black solid line with a circle as the...
Write as a MatLab function P5: For X=0 ~ 2π with intervals of π/100 use the following equations Y4=sin(X), Y5=sin(X-0.25), Y6=sin (X-1.5), Y7=sin(X-0.85), Y8=sin(X)sin(X+0.75) a. Plot Y4, Y5 and Y6 in the same plot. Add title, labels, legend. Plot them with different colors and line styles b. Plot Y4, Y5, Y6 and Y7 as subplots. Add title, labels. Plot them with different colors and line styles c. Plot Y4 and Y8 in the same plot using the hold on/off. Add...