Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Help Help

Subject: Help Help

From: Neha

Date: 24 Apr, 2009 06:44:39

Message: 1 of 2

I am trying to plot a signal, and want to take some random points on
it here is my problem

on x axis wt= 128 by 1
on y axis w = 128 by 1
now random sampling of this
on x axis t=128 by 1

i am getting some plot, but i am also getting zero on my grapph, i
dont want to plot zeros that are in w, how to avoid zeros in a plot
like at particular place t=.9 and wt=0 then i am getting point on zero
i want to remove all zeros from my plot how to do it

Subject: Help Help

From: Gustavo Morales

Date: 25 Apr, 2009 06:04:09

Message: 2 of 2

Neha:
I didn't understand you very well, but, I'll try to help you.
Let's say you have these 2 vectors:
  x = [-2, -1, 0, 1, 2, 3]; y = [23.4, 27, 31.05, 21, 0, -15];
 both with same size and you plot them:
  plot(x,y);
if you want to eliminate the zeroes values from the dependent vector (y), you can do this:
ind = (y ~= 0);
y = y(ind); % removing the zeroes values but maybe reducing its size
x = x(ind); % removing the corresponding x values and plot again

I hope this helps you.
Regards from Venezuela..!!

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us