Matrix dimension must agree
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
sashish acharya
el 21 de Mzo. de 2016
Comentada: Star Strider
el 21 de Mzo. de 2016
I wanna generate multiple carrier bt m getting error at line c(i,:)=.......
nos=4;
Tb=1;
fc=[10 30];
t=0:Tb/100:1;
A=5
for i=1:nos
c(i,:)=A*sin(2*pi*fc(i,:).*t);
end
0 comentarios
Respuesta aceptada
Star Strider
el 21 de Mzo. de 2016
Replace your ‘fc’ assignment with:
fc = linspace(10, 30, nos);
so your code becomes:
nos=4;
Tb=1;
fc = linspace(10, 30, nos);
t=0:Tb/100:1;
A=5;
for i=1:nos
c(i,:)=A*sin(2*pi*fc(i)*t);
end
See if that does what you want.
2 comentarios
Star Strider
el 21 de Mzo. de 2016
The sine waves are there. If you want them with better resolution, sample them more frequently, for example with:
t=0:Tb/500:1;
Más respuestas (1)
Azzi Abdelmalek
el 21 de Mzo. de 2016
Editada: Azzi Abdelmalek
el 21 de Mzo. de 2016
There are many mistakes in your code
fc=[10 30];
the size of fc is [1 2], then fc(i,:) is not defined for i=2. also you are writing fc.*t, while fc and t have different sizes
3 comentarios
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!