使用词干X的错误必须与y的长度相同

  • 本文关键字:词干 错误 matlab
  • 更新时间 :
  • 英文 :


我试图找到x数组的偶数和奇数部分,但它返回我错误使用干,x必须与Y长度相同这是我在matlab中的代码

close all;
clear all;
clc;
n1 = -5:1:5;
AM = 19390;
x = [1,9,3,9,0,1,1,9,3,9,0];
fun(x,n1);

function [sima,xr] = fun(t,x)  
x_reverse = fliplr(x);% time reversal
sima = 0.5*(x + x_reverse); %even component
xr = 0.5*(x - x_reverse); %odd component
subplot(3,1,1);
stem(t,x);
title('Your signal x')
subplot(3,1,2); 
stem(t,sima);
title('Even part');
subplot(3,1,3);
stem(t,xr);
title('Odd part');
end

fun的输入反向。

fun(x,n1)

你应该有

fun(n1,x)

这或反转fun中每个stem的每个引用向量和值向量的顺序。

最新更新