Matrix Dimension must agree..

4 visualizaciones (últimos 30 días)
sashish acharya
sashish acharya el 25 de Mzo. de 2016
Editada: Stephen23 el 25 de Mzo. de 2016
i want to perform product of msg n carrier to obtain ook modulated signal bt m getting error while doing product
samples=1000;
nos=4;
%generate carrier signal
cfreq=[30 40 60 100];
t=linspace(0,1000,samples);
parfor i=1:nos
x(i,:)=sin(2*pi*cfreq(1,i)*t);
end
%input msg signal
for i=1:nos
p(i,:)=input('enter sequence');
l(i,:)=length(p(i,:));
end
%modulation
for i=1:nos
y(i,:)=x(i,:).*p(i,:); % *error:* matix dimension must agree
end

Respuesta aceptada

Roger Stafford
Roger Stafford el 25 de Mzo. de 2016
The error message is telling you what the trouble is. The vector x(i,:) has 1000 elements for each 'i', but p(i,:) was input and clearly the user would not have the patience to enter 1000 values. Yet the element-wise multiplication x(i,:).*p(i,:) requires that they be of the same size. You had better rethink what you are doing.

Más respuestas (0)

Categorías

Más información sobre Wireless Communications en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by