How to plot signal with many legs which has NaN elements
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am given a signal with 2 legs that I will have to plot. The plot which confuses me is e.g. for the part of the signal which is: 1/(2-t) for t > 3 and t<5. I create a logical array with only ones at range[3,5] but after I create the output for this leg of the function, when I merge the different legs using addition to get them into one function , I get an error as at some parts I have NaN values (which is obvious, as for t = 2 there is division with zero). How can I get rid of them? I tried using a for loop to only go through the parts I care about but I can't get this to work, and it makes my solution kinda messy. Any suggestions? Thanks
Some code for example:
t = -10:0.1:10;
int1 = (t>-1) & (t<0);
int2 = (t>3) & (t<5);
l2 = int2 .* (1 ./ t);
l1 = ...
final = l1 + l2; % the whole final signal/function representation
plot(t,final); % appears with gaps
0 comentarios
Respuestas (1)
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!