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

1 view (last 30 days)
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 Comment
Stephen23
Stephen23 on 27 Apr 2017
Edited: Stephen23 on 27 Apr 2017
You are calling sigadd, but have shown us a function named sig_mult. Please edit your question and show us the code for sigadd.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!