convolution shape (full/same/valid)

25 ビュー (過去 30 日間)
Rex Cheang
Rex Cheang 2021 年 8 月 25 日
コメント済み: Rex Cheang 2021 年 8 月 26 日
clear all
close all
%Sampling time
Ts=0.001;
t=0:Ts:2*pi;
%Timeaxis
TimeAxes_x = [0 0.1 -2*pi 2*pi];
TimeAxes_y = [0 60 0 10^7];
%Functions
f1 = 2*cos(100*pi*t)+cos(60*pi*t);
f3 = 2*cos(100*pi*(t-2))+cos(60*pi*(t-2));
f4 = conv(f1,f3,'full');
%Sampling frequency
fs=1/Ts;
fre=(0:length(f4)-1)*fs/length(f4);
%Fourier transform
F4 = fft(f4);
F1 = fft(f1);
F3 = fft(f3);
convf = conv(F1,F3,'full');
%plotting F4
graph_subplot(1,211,fre,abs(F4),TimeAxes_y,'f(Hz)','F4(w)','Frequency domain for conv(f1,f3)');
%plotting F4_2
graph_subplot(1,212,fre,abs(convf),TimeAxes_y,'f(Hz)','F4(w)','F1(w)*F4(w)');
These are the codes for the two plots, I just wonder why I got nothing in the graph when I do 'same' for the convolution but I got the attached graph when I do 'full'.
  2 件のコメント
Bjorn Gustavsson
Bjorn Gustavsson 2021 年 8 月 26 日
Plot your functions, ponder about what happens and why. It is your homework problem to solve.
Rex Cheang
Rex Cheang 2021 年 8 月 26 日
I just want to know why Im not having anything when I do for example, conv(f1,f3, 'same') but I am getting something for 'full'

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeFourier Analysis and Filtering についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by