MATLAB: Working of interpolation or decimation decimationimage processinginterpolationMATLAB Hello, Can someone explain how the interpolation or decimation can be used to fit the number of samples between the two signals if both the signals doesn't have the same number of samples. Thanks. Best Answer See this demo:% Make signal #1t1 = linspace(-2*pi, 2*pi, 200);period = 1.5;y1 = sin(2*pi*t1/period);plot(t1, y1, 'bo-', 'LineWidth', 6, 'MarkerSize', 20);grid on;% Enlarge figure to full screen.set(gcf, 'units','normalized','outerposition',[0 0 1 1]);% Make signal #2t2 = linspace(-2*pi, 2*pi, 130);period = 1.5;y2 = sin(2*pi*t2/period);hold on;plot(t2, y2, 'ys-', 'LineWidth', 4);% Interpolate signal 2 up to have same number of samples as signal 1y2Interp = interp1(t2, y2, t1);plot(t1, y2Interp, 'rd-', 'LineWidth', 2);legend('signal 1', 'signal 2', 'signal 2 interpolated');% Now get signal half way between the signal #1 % and the interpolated signal #2signal3 = 0.5 * y1 + 0.5 * y2Interp;I trust you can do the case where you want to interpolate y1 down to the lesser number of samples that y2 has - it's straightforward. Related SolutionsMATLAB: I want to find the determinant for 5.5 matrix >> syms s1 s2 s3 s4 s5 s6 s7 s8 s9 s10>> M = [0 -s1 -s2 -s3 -s4; s1 0 -s5 -s6 -s4; s2 s5 0 -s8 -s9; s3 s6 s8 0 -s10; s4 s7 s9 s10 0];>> det(M)ans =s1*s4^2*s8^2 - s1*s4*s7*s8^2 - s2*s4^2*s6*s8 + s3*s4^2*s5*s8 - s3^2*s4*s5*s9 - s2^2*s4*s6*s10 + s3^2*s5*s7*s9 + s2^2*s6*s7*s10 + s2*s3*s4*s5*s10 + s2*s3*s4*s6*s9 + s1*s2*s4*s8*s10 - s1*s3*s4*s8*s9 - s2*s3*s5*s7*s10 - s2*s3*s6*s7*s9 + s2*s4*s6*s7*s8 - s3*s4*s5*s7*s8 - s1*s2*s7*s8*s10 + s1*s3*s7*s8*s9>> simplify(ans)ans =(s4 - s7)*(s3*s5 - s2*s6 + s1*s8)*(s2*s10 - s3*s9 + s4*s8) MATLAB: Input variable value to matrix syms s1 s2 s3subs(left_ARE,{s1, s2, s3}, {1, 5, 10}) Related QuestionInterp1 Error using interp1>reshapeAndSortXandVMatlab solve indeterminate polynomial equations numerically1D Interpolation of a signal – beginners questionError struct with fieldInterp1 yields NaN for two signals interpolation of the same sampling frequencySolving system of equations with parameters
Best Answer