Question

In: Computer Science

Clamped Splines Let t = [1:60]; x = [68 126 86 71 100 177 233 271...

Clamped Splines Let

t = [1:60]; x = [68 126 86 71 100 177 233 271 206 269 340 269 315 384 431 467 382 440 511 558 565 529 511 551 682 665 642 671 796 774 749 758 796 834 878 896 847 836 872 925 978 981 989 1041 1070 1067 1138 1167 1167 1167 1167 1194 1245 1196 1167 1165 1167 1196 1167 1134]; y =-[238 226 189 238 295 231 184 240 289 235 195 231 295 249 184 189 244 291 246 233 193 193 246 289 115 35 273 298 111 33 44 286 280 242 238 193 191 242 291 271 184 293 233 182 211 289 242 209 80 160 278 298 246 298 275 206 155 153 157 162]; 1. Use cubic splines with clamped conditions to fit the data t and y. 2. Let tt=linspace(t(1),t(end),200); and evaluate the cubic spline at tt and assign the result to a varibale called y1. 3. Find spline (from 1) at 45. Show your MATLAB code and result

Solutions

Expert Solution

ANSWER:

  • I have provided the properly commented code in both text and image format so you can easily copy the code as well as check for correct indentation.
  • I have provided the output image of the code so you can easily cross-check for the correct output of the code.
  • Have a nice and healthy day!!

CODE TEXT

% defining variables as provided in question
t = 1:60;
x = [68 126 86 71 100 177 233 271 206 269 340 269 315 384 431 467 382 440 ...
    511 558 565 529 511 551 682 665 642 671 796 774 749 758 796 834 878 896 ...
    847 836 872 925 978 981 989 1041 1070 1067 1138 1167 1167 1167 1167 ...
    1194 1245 1196 1167 1165 1167 1196 1167 1134]; 
y =-[238 226 189 238 295 231 184 240 289 235 195 231 295 249 184 189 244 ...
    291 246 233 193 193 246 289 115 35 273 298 111 33 44 286 280 242 238 ...
    193 191 242 291 271 184 293 233 182 211 289 242 209 80 160 278 298 ...
    246 298 275 206 155 153 157 162];

% 1. cubic spline with clamped condition, using function csape of matlab
% with end points condition
% fitting on t and y with endpoints condition [1 0]
splineFit = csape(t,y,[1 0]);

% 2. evaluate the cubic spline at tt
tt = linspace(t(1),t(end),200);
% y values for tt
y1 = ppval(splineFit,tt);

% 3. spline at 45
spline45 = y(45);

% displaying result by ploting
plot(t,y,'o',"DisplayName","Data Points");
hold on;
plot(tt,y1,"DisplayName","Cubic Spline");

% ploting point 45
plot(45,spline45,'kx',"MarkerSize",12,"DisplayName","Spline at 45");
legend();

% labelling plot
ylabel("y");
xlabel("t");
title("t vs y");

CODE IMAGE

OUTPUT IMAGE


Related Solutions

Let t = [1:60]; x = [68 126 86 71 100 177 233 271 206 269...
Let t = [1:60]; x = [68 126 86 71 100 177 233 271 206 269 340 269 315 384 431 467 382 440 511 558 565 529 511 551 682 665 642 671 796 774 749 758 796 834 878 896 847 836 872 925 978 981 989 1041 1070 1067 1138 1167 1167 1167 1167 1194 1245 1196 1167 1165 1167 1196 1167 1134]; y =-[238 226 189 238 295 231 184 240 289 235 195 231 295...
Let X = {1, 2, 3}. Find all topologies T on X such that (X, T...
Let X = {1, 2, 3}. Find all topologies T on X such that (X, T ) is regular.
Let T denote the counterclockwise rotation through 60 degrees, followed by reflection in the line y=x...
Let T denote the counterclockwise rotation through 60 degrees, followed by reflection in the line y=x (i) Show that T is a linear transformation. (ii) Write it as a composition of two linear transformations. (iii) Find the standard matrix of T.
Let T denotes the counterclockwise rotation through 60∘, followed by reflection in the line y=x. (i)...
Let T denotes the counterclockwise rotation through 60∘, followed by reflection in the line y=x. (i) Show that T is a linear transformation. (ii) Write it as a composition of two linear transformations. (iii) Find the standard matrix of T.
1. Let X and Y be non-linear spaces and T : X -->Y. Prove that if   ...
1. Let X and Y be non-linear spaces and T : X -->Y. Prove that if    T is One-to-one then T-1 exist on R(T) and T-1 : R(T) à X is also a linear map. 2. Let X, Y and Z be linear spaces over the scalar field F, and let T1 ϵ B (X, Y) and T2 ϵ B (Y, Z). let T1T2(x) = T2(T1x) ∀ x ϵ X. (i) Prove that T1T2 ϵ B (X,Y) is also a...
Let X ~ exp(λ) MGF of X = λ/(1-t) a) What is MGF of Y =...
Let X ~ exp(λ) MGF of X = λ/(1-t) a) What is MGF of Y = 3X b) Y has a common distribution, what is the pdf of Y? c) Let X1,X2,....Xk be independent and identically distributed with Xi ~ exp(λ) and S = Σ Xi (with i = 1 below the summation symbol, and k is on top of the summation symbol). What is the MGF of S? d) S has a common distribution. What is the pdf of...
1. If d1=.15, What is N(d1)? (round to 4 decimal places) 2. S0=105; X=100; r=.02; T=60...
1. If d1=.15, What is N(d1)? (round to 4 decimal places) 2. S0=105; X=100; r=.02; T=60 days; standard deviation of daily returns = .012; Assume 365 calendar days in a year and 255 trading days in a year. Assume N(d1) =0.76 and N(d2) = 0.74 (irrespective of your calculations for d1 and d2), what is the price of a call option according to Black-Scholes? (round to 2 decimal places)
Let x(t) ∈ [0, 1] be the fraction of maximum capacity of a live-music venue at...
Let x(t) ∈ [0, 1] be the fraction of maximum capacity of a live-music venue at time t (in hours) after the door opens. The rate at which people go into the venue is modeled by dx dt = h(x)(1 − x), (1) where h(x) is a function of x only. 1. Consider the case in which people with a ticket but outside the venue go into it at a constant rate h = 1/2 and thus dx dt =...
1. Let the demand function be Q(d) = 100 – 3P(X). a. What is the own...
1. Let the demand function be Q(d) = 100 – 3P(X). a. What is the own price elasticity of demand when P = 10? b. What is the own price elasticity of demand when P = 20? c. What is the own price elasticity of demand when P = 30? d. Find the inverse demand function and graph the demand curve. Note for each of the questions above whether it is along the price elastic or price inelastic portion of...
Applied Math Let T be the operator on P2 defined by the equation T(f)=f+(1+x)f' (a) Show...
Applied Math Let T be the operator on P2 defined by the equation T(f)=f+(1+x)f' (a) Show T i linear operator from P2 into P2! (b) Give matrix reppressentaion in base vectorss B={1,x,x2}! (c) Give a diagonal matrix representing T (d) Give a diagonal matrix representing T Where P2 is ppolynomials with degree less then or equal to 2 and f' is the derivative of polynomial f.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT