About the expression to the left of the equals sign is not a valid target for...

1 次查看(过去 30 天)
Hi,
Try this function to sum two vectors. But when i send parameters it didnt work with an error message(About the expression to the left of the equals sign is not a valid target for...)
This is my function:
if true
%
function [y, n] = sig_mult(k1, n1, k2, n2)
n = min(min(n1), min(n2)):max(max(n1), max(n2));
y1 = zeros(1, length(n));
y2 = y1;
y1 = ((find(n>=min(n1)) & (n<=max(n1)) == 1)) = k1;
y2 = ((find(n>=min(n2)) & (n<=max(n2)) == 1)) = k2;
y = y1.*y2;
end
And this is my parameters to output two signals:
if true
% >> n1 = -2:10;
n2 = 1:14;
x1 = rand(size(n1));
x2 = rand(size(n2));
stem(n1,x1,'k');
stem(n2,x2,'r');
[x3,n3] = sigadd(x1,n1,x2,n2);
Error: File: sigadd.m Line: 7 Column: 47
The expression to the left of the equals sign is not a valid target for an
assignment.
end
  1 个评论
Stephen23
Stephen23 2017-4-27
编辑:Stephen23 2017-4-27
You are calling sigadd, but have shown us a function named sig_mult. Please edit your question and show us the code for sigadd.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Multirate Signal Processing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by