Question
(THIS QUESTION BELOW IS TO FIND THE SOLUTION WHEN SEARCHING GOOGLE. I WOULD LIKE THE ENTIRE QUESTION ANSWERED IF POSSIBLE PLEASE) a) Develop function myinterpolation
(THIS QUESTION BELOW IS TO FIND THE SOLUTION WHEN SEARCHING GOOGLE. I WOULD LIKE THE ENTIRE QUESTION ANSWERED IF POSSIBLE PLEASE)
a) Develop function myinterpolation as shown in class and test it with a simple six points dataset; x=0:5; y=[15 10 9 6 2 0]; interpolate x=3.5.
b) Plot the data with T on the x-axis and k on the y-axis.
c) Use myinterpolation function to find the values of k for T=500K and T=590K.
d) Use the Matlab function linterp to find the values of k for T=500K and T=590K
e) Use the Matlab function interp1 with the spline option to find the values of k for T=500K and T=590K
HERE IS HW 8 CODES FOR THIS PROBLEM:
Problem 1)
clc
clear all
%PART B
%data
xi=[1 2 4 5]';
yi=[1 2 2 3]';
%funtion test
[a,b]=myline1(xi,yi);
%PART C
%polyfit
poly=polyfit(xi,yi,1);
%space checking
xi=linspace(1,5,10);
yi1=polyval([a b],xi);
yi2=polyval(poly,xi);
%results
plot (xi,yi1,'rx',xi,yi2,'bo')
%PART A
function [a,b]=myline1(xi,yi)
nVal=length(xi);
a=(sum(xi)*sum(yi)-nVal*sum(xi.*yi))/(sum(xi)^2-nVal*sum(xi.^2));
b=(sum(xi)*sum(xi.*yi)-sum(xi.^2)*sum(yi))/(sum(xi)^2-nVal*sum(xi.^2));
end
Sample Output:
A = 0.4000
B = 0.8000
Problem 2)
%Problem 2a
%Temperature
T=[200 400 600 800 1000];
k=[1.46E-7 0.0012 0.0244 0.1099 0.2710];
k=[1.46e-7 0.0012 0.0244 0.1099 0.2710];
semilogy(1./T,k)
title('1/T Vs ln(k)');
xlabel('1/T');
ylabel('ln(k)');
%Problem 2b
a=myline1(1./T,log(k));
disp('The slope of -Q/R is')
fprintf('%4.4f ',a(1))
disp('The intercept, ln(k0) is')
fprintf('%4.4f ',a(2))
The slope of -Q/R is
-3608.4999
The intercept, ln(k0) is
2.3010
%Problem2c
ln_k1=b+a*(1/500);
k=exp(ln_k)
%Problem 2d
R=8.314;
Q=-R.*a(1);
disp('The value of Q is')
fprintf('%6.4f ',Q)
The value of Q is
30001.0683
%Problem 2e
k0=exp(a(2));
disp('The value of k0 is')
fprintf('%6.4f ',k0)
The value of k0 is
9.9841
HW 9 This problem is the continuation of problem2 of HW8. Chemical reaction rates depend on a reaction-rate constant that is a function of temperature and activation energy ORT k koei In HW8 you linearized the formulation and interpolated unknown values on the linear version of the formulation. In this problem we assume that we have no knowledge of mathematical relationship between T and k. a) Develop function myinterpolation as shown in class and test it with a simple six points dataset: xa 0:5; y [15 10 9 6 2 0]: interpolate x 3.5. Now consider the following data T, K 1.46 x 10 200 0.0012 400 600 0.0244 800 0.1099 1000 0.2710 b) Plot the data with Ton the x-axis and k on the v-axis c Use myinterpolation function to find the values ofk for T 500K and T 590K. d Use the Matlab function linterp to find the values of k for T 500K and T 590K. e) Use the Matlab function interpl with the 'spline' option to find the values of k for T 500K and 590K. f Discuss and compare the results from Hws, part d, and part eStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started