how to plot impulses obtaining x and y values (non periodic) from 2 separate matrices
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Ruben Leon
el 12 de Nov. de 2021
Comentada: Ruben Leon
el 15 de Nov. de 2021
I want to be able to plot x and y data stored in two separate matrices as an impulse graph similar to the image below but not periodic. I know the stem function is used to generate these types of graphs but the difference here is that my data is aperiodic. Any feedback would be much appreciated. Thank you.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/798554/image.png)
2 comentarios
Paul
el 12 de Nov. de 2021
It would be helpful to post input data for the simplest possible example that illustrates the problem and explain how that data should be turned into the desired output.
Respuesta aceptada
Paul
el 13 de Nov. de 2021
Is one of these what you want?
SpurOffsetFreq = [37.467 56.486 85.159; 56.486 86.693 113.309];
SpurLeveldBc = [-96.527 -97.912 -83.814; -100.779 -84.146 -92.496];
% two separate stem plots
figure;
hold on;
for ii = 1:2
stem(SpurOffsetFreq(ii,:),SpurLeveldBc(ii,:),'BaseValue',-110);
end
% single stem plot
figure
stem(SpurOffsetFreq(:),SpurLeveldBc(:),'BaseValue',-110)
1 comentario
Más respuestas (1)
Dave B
el 13 de Nov. de 2021
I think you were correct that stem is the correct command. I'm not sure why periodicity factors in, from your description...how about this?
SpurOffsetFreq = [37.467 56.486 85.159; 56.486 86.693 113.309];
SpurLeveldBc = [-96.527 -97.912 -83.814; -100.779 -84.146 -92.496];
% the loop is not necessary when your data are in a matrix
stem(SpurOffsetFreq,SpurLeveldBc,'filled','BaseValue',-110)
xlabel('Spur Offset Frequency (KHz)')
ylabel('Spur Level (dBc)')
Ver también
Categorías
Más información sobre Graphics Performance 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!