Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

WRITE A MATLAB CODE TO SOLVE THE FOLLOWING PROBLEM using numerical methods for s

ID: 3868865 • Letter: W

Question

WRITE A MATLAB CODE TO SOLVE THE FOLLOWING PROBLEM

using numerical methods for scientists and engineers 3rd edition

RESULTS SHOULD BE AS FOLLOW

Problem # 3 P-3 Flow between two parallel plates is described by the following equation: d'u 1 op with boundary conditions given as u-,-0 & u,-0 ox Calculate the velocity profile using the shooting method for solving the given BVP and compare your results by plotting the numerical solution over the plot of the analytical solution described by: u- g ( Hint: use 1.75 for the first initial slope, and the other one is 0.45 to 0.5. resuls by plotting the numerical soli tfhe shooting method for sol op y2_h2) where-?=_0.000025, -0.75 and h= ±30 ox

Explanation / Answer

load sensorData

t1 = (0:length(s1)-1)/Fs;
t2 = (0:length(s2)-1)/Fs;

subplot(2,1,1)
plot(t1,s1)
title('s_1')

subplot(2,1,2)
plot(t2,s2)
title('s_2')
xlabel('Time (s)')
[acor,lag] = xcorr(s2,s1);

[~,I] = max(abs(acor));
lagDiff = lag(I)
figure
plot(lag,acor)
a3 = gca;
a3.XTick = sort([-3000:1000:3000 lagDiff]);
s1al = s1(-lagDiff+1:end);
t1al = (0:length(s1al)-1)/Fs;

subplot(2,1,1)
plot(t1al,s1al)
title('s_1, aligned')

subplot(2,1,2)
plot(t2,s2)
title('s_2')
xlabel('Time (s)')
timelag = 0.23;
delta = round(Fs*timelag);
alpha = 0.5;

orig = [mtlb;zeros(delta,1)];
echo = [zeros(delta,1);mtlb]*alpha;

mtEcho = orig + echo;
t = (0:length(mtEcho)-1)/Fs;

subplot(2,1,1)
plot(t,[orig echo])
legend('Original','Echo')

subplot(2,1,2)
plot(t,mtEcho)
legend('Total')
xlabel('Time (s)')
[cr,lgs] = xcorr(xabc,'coeff');

for row = 1:3
for col = 1:3
nm = 3*(row-1)+col;
subplot(3,3,nm)
stem(lgs,cr(:,nm),'.')
title(sprintf('c_{%d%d}',row,col))
ylim([0 1])
end
end
[cr,lgs] = xcorr(xabc,5,'coeff');

for row = 1:3
for col = 1:3
nm = 3*(row-1)+col;
subplot(3,3,nm)
stem(lgs,cr(:,nm),'.')
title(sprintf('c_{%d%d}',row,col))
ylim([0 1])
end
end

cu = xcorr(xabc,'unbiased');

for row = 1:3
for col = 1:3
nm = 3*(row-1)+col;
subplot(3,3,nm)
stem(-(N-1):(N-1),cu(:,nm),'.')
title(sprintf('c_{%d%d}',row,col))
end
end
stem(lags,c);
hold on
plot(nn,dd)
xlabel('Lag')
legend('xcorr','Analytic')
hold off
cu = xcorr(x,'unbiased');

du = dd./(N-abs(nn));

stem(lags,cu);
hold on
plot(nn,du)
xlabel('Lag')
legend('xcorr','Analytic')
hold off

cb = xcorr(x,'biased');

db = dd/N;

stem(lags,cb);
hold on
plot(nn,db)
xlabel('Lag')
legend('xcorr','Analytic')
hold off

N = 16;
n = 0:N-1;

a = 0.84;
b = 0.92;

xa = a.^n;
xb = b.^n;

r = xcorr(xa,xb);

stem(-(N-1):(N-1),r)

figure

stem(-(N-1):(N-1),xcorr(xb,xa))

hold on
stem(-(N-1):(N-1),fliplr(r),'--*')

xlabel('Lag')
legend('xcorr(x_b,x_a)','fliplr(xcorr(x_a,x_b))')
xc = 0.77.^(0:20-1);

[xca,la] = xcorr(xa,xc);
[xcb,lb] = xcorr(xb,xc);

figure

subplot(2,1,1)
stem(la,xca)
subplot(2,1,2)
stem(lb,xcb)
xlabel('Lag')