I'm trying to implement this model inatlab:

enter image description here

I know that Ri = 2 and Si = -0.05+3j, ignore n(t). I want to plot the signal in time response, this is what I got so far:

   Fs = 1000;                   % samples per second
   dt = 1/Fs;                   % seconds per sample
   Time = 10;                   % seconds
   t = (0:dt:Time-dt)';         % seconds
   y = 2*exp((-0.05+3j)*t);
   xlabel('time (in seconds)');
   title('Signal in Time response');

The problem I'm having at the moment is when I'm plotting this in Matlab, I get a warning saying the imaginary part of the complex is being ignored but I'm still able to get a graph.

If my approach is correct, how would I determine the time value?

  • 1
    \$\begingroup\$ The time is fine -- it's the value of y that is complex. You'll need to plot the real and imaginary components separately. \$\endgroup\$
    – Dave Tweed
    Sep 10, 2019 at 15:18
  • \$\begingroup\$ y(t)=a(t) +jb(t) Plot a,b (t) \$\endgroup\$ Sep 10, 2019 at 15:39

1 Answer 1


As @Dave Tweed mentioned, the time component of your function is fine. The crux of your problem is that you've asked Matlab to plot y vs t in a 2D plot when you've given three variables real(y), imag(y), t. It can't do that so it's truncated the imaginary part of y and given you the warning to let you know. You've got a lot of options for how to display them both. I like 3D plots, but two lines will usually do the trick.

Something like the following rough code:

plot(t, real(y))
hold on
plot(t, imag(y))
hold off

Will produce something like this:


A quick sanity check: at t = 0, we've got y = 2*exp(0) = 2 + j0. Looks good. Add your title, x-axis label, y-axis label, and legend and you're good to go.

If you're bound to a 2D plot with one axis being time then the above is an option. However, as @user24368 mentioned you could also plot magnitude and angle. If you don't need to plot against time you can also plot the real vs the imaginary components of the signal.

It's up to you to determine the best way to convey the data to the target audience; whether that's a professor or a work presentation.

  • 1
    \$\begingroup\$ I don't know what is the physical interpretation of the y(t), but it might be more useful to plot the absolute value and the phase. Or maybe even plot only the absolute value if the phase is not interesting. \$\endgroup\$
    – user24368
    Sep 10, 2019 at 17:05
  • \$\begingroup\$ @user24368 -- I agree. \$\endgroup\$
    – user199402
    Sep 10, 2019 at 17:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.