Professional Documents
Culture Documents
Table of Contents
Clean Up .......................................................................................................................... 1
Honor Statement ................................................................................................................ 1
Problem 1 - Inspect the Unknown Signal ................................................................................ 1
Problem 2 - Differentiate and Integrate the low resolution signal ................................................. 2
Problem 3 - Interpolate low resolution signal ........................................................................... 3
Problem 4 - differentiate and integrate the interpolated signal ..................................................... 4
Problem 5 - Analyze Results ................................................................................................ 5
Clean Up
clear all
close all
clc
Honor Statement
On my honor, I have neither given nor received aid on this assignment, and I pledge that I am in compliance
with the VCU Honor System
subplot(2,1,1);
plot(x_19, y_19, '-b', x_19, dydx_19, '-g', x_19, iy_19, '-r');
xlabel('x');
ylabel('y');
title('Unknown Functions (Low Res)');
legend('y', 'dy/dx', '\int (y)')
subplot(2,1,2);
1
Juei-Sheng Chiu - Module 1, Com-
putational Methods (EGRB 215)
2
Juei-Sheng Chiu - Module 1, Com-
putational Methods (EGRB 215)
xlabel('x');
ylabel('y');
title('Integration of Unknown Functions');
legend('\int (y)', 'Estimate')
figure(3);
subplot(2,2,1);
plot(x_601, y_601, '-b', x_601, y_19near, '-g');
xlabel('x');
ylabel('y');
title('Unknown Function Interpolation');
legend('y', 'nearest')
subplot(2,2,2);
plot(x_601, y_601, '-b', x_601, y_19lin, '-g');
xlabel('x');
ylabel('y');
title('Unknown Function Interpolation');
legend('y', 'linear')
3
Juei-Sheng Chiu - Module 1, Com-
putational Methods (EGRB 215)
subplot(2,2,3);
plot(x_601, y_601, '-b', x_601, y_19spl, '-g');
xlabel('x');
ylabel('y');
title('Unknown Function Interpolation');
legend('y', 'spline')
subplot(2,2,4);
plot(x_601, y_601, '-b', x_601, y_19cub, '-g');
xlabel('x');
ylabel('y');
title('Unknown Function Interpolation');
legend('y', 'cubic')
%Differntiation
for i = 2:(size(y_19spl,2)-1) %using Central Difference method
dydxc_19spl(1,i-1) = (y_19spl(1,i+1)-y_19spl(1,i-1))/...
4
Juei-Sheng Chiu - Module 1, Com-
putational Methods (EGRB 215)
(x_601(1,i+1)-x_601(1,i-1));
end
figure(4);
subplot(2,1,1);
plot(x_601, dydx_601, '-b', x_601(1,2:600), dydxc_19spl, '-g');
xlabel('x');
ylabel('y');
title('Differentiation of Unknown Functions');
legend('dy/dx', 'Estimate');
% Integral
y_19spl_cumtrapz = cumtrapz(x_601, y_19spl)+ iy_601(1,1);
subplot(2, 1, 2);
plot(x_601, iy_601, '-b', x_601, y_19spl_cumtrapz, '-g');
xlabel('x');
ylabel('y');
title('Integration of Unknown Functions');
legend('\int (y)', 'Estimate');
5
Juei-Sheng Chiu - Module 1, Com-
putational Methods (EGRB 215)