۱۳۹۲/۰۸/۱۱, ۱۰:۰۹ ب.ظ
سلام این کدیه که من برا convolve نوشتم و میخوام function اش کنم خود کد درسته ولی تو فانکشنش مشکل دارم.خود کد رو هم اینجا میارم و هم فانکشنی که براش نوشتم ممنون میشم بگین مشکل فانکشنش چیه.اروری که برا اجرای فانکشن میاره اینه :Not enough input arguments.
خود کد:
it's function:
خود کد:
کد:
clc;
clear all;
close all;
t=0:1/20:9*(1/20);
x=rand(1,10);
subplot(3,3,1);plot(t,x)
title('x(t)','color','B')
t=0:1/20:9*(1/20);
h=rand(1,10)';
subplot(3,3,2);plot(t,h)
title('h(t)','color','B')
for i=1:length(h)
X(i:length(x)+(i-1),i)=(x(1,:))'
end
y=X*h;
% I titled y=X*h as "Mconv(x,h)"
subplot(3,3,4);plot(y);title('Mconv(x,h)','color','B')
subplot(3,3,5);plot(conv(x,h));title('conv(x,h)','color','B')
it's function:
کد:
function [ X ] = Mconvolve(x,h)
for i=1:length(h)
X(i:length(x)+(i-1),i)=(x(1,:))';
end
end