Hiee I am new to matlab help me out solving this error in my program:

9 visualizaciones (últimos 30 días)
AKHIL REDDY
AKHIL REDDY el 3 de Abr. de 2016
Comentada: Star Strider el 3 de Abr. de 2016
This is my program:
clc;
close all;
clear all;
x= [0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0];
%--Polar NRZ--%
y=2.*x-1;
figure
stairs(1:length(y),y)
title('Polar Non Return to Zero')
ylim([-1.2 1.2]);
G=63; % Code length
%Generation of first m-sequence using generator polynomial [45]
sd1 =[0 1 0 0 0 1]; % Initial state of Shift register
PN1=[]; % First m-sequence
for j=1:G
PN1=[PN1 sd1(5)];
if sd1(1)==sd1(4)
temp1=0;
else temp1=1;
end
sd1(1)=sd1(2);
sd1(2)=sd1(3);
sd1(3)=sd1(4);
sd1(4)=sd1(5);
sd1(5)=temp1;
end
figure
subplot(3,1,1)
stem(PN1)
title('M-sequence generated by generator polynomial [45]')
figure
z= xor(x,PN1);
stem(z);
t=0:.000001:1; % independent (time) variable
A = 8; % amplitude
f1 = 20;
s1 = A*sin(2*pi*f1*t);
figure
plot(t,s1);
t=0:.000001:1;
o= s1*z;
figure
plot(t,o);
title('output')
  1 comentario
Star Strider
Star Strider el 3 de Abr. de 2016
The error is here:
o= s1*z;
where you are trying to multiply ‘s1’, a (1x1000001) double by ‘z’, a (1x63) logical.
What do you want to do?

Iniciar sesión para comentar.

Respuestas (0)

Categorías

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

Community Treasure Hunt

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

Start Hunting!

Translated by