[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Combined plot

From: Blaz
Subject: Combined plot
Date: Wed, 27 Jan 2021 01:59:41 -0600 (CST)

I have two issues to solve in Octave. 

First issue

 I have a vector [x]. Is there a simple way to create two new vectors (e.g.
xodd and xeven)? xodd is (obviously) composed from odd index-es of x and
xeven from even ones. I have written the code below, but it fills the blanks
with zeros, which is not ok. I would like to have only the extracted values
in new vectors.

t = [0:0.001:0.03];
x = sin(2*pi*50*t);
for i=1:length(t)
  if rem(i,2) == 0
  if rem(i,2) == 1

Second issue

When I do have x, xodd and xeven vectors properly calculated I wish to plot
them as following

1. x as a simple plot (x) on first diagram (e.g . subplot (311))
2. x as a simple plot (x) and xeven as arrows between x-axis and plotted x
curve (subplot 312)
3. x as simple plot(x) and xodd as arrows between x-axis and plotted x curve
(subplot 313)

I tried with bar (xodd) and bar(xeven), but I would like to plot the arrows
instead of bars. 

Any help is much appreciated


Sent from:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]