help-octave
[Top][All Lists]

## Re: newbie question - unsigned conversion

 From: Ben Sapp Subject: Re: newbie question - unsigned conversion Date: Thu, 16 Jan 2003 08:54:55 -0700

```I think abs() will do what you want.  Something like:

data = abs([x , ...  ]);

instead of the current data assignment.

Ben

At 02:32 PM 1/16/2003 +0100, James Ridewood wrote:
```
```Hi,

Just a fairly simple one I hope:

just did this to plot a simple waveform:

x = (0:1:720)';
data = [x, sin((x-15)*(pi/180)), sin((x-105)*(pi/180)),
sin((x-135)*(pi/180)), sin((x-225)*(pi/180)), sin((x-255)*(pi/180)),
sin((x-345)*(pi/180))];
gplot [0:720] [-1.1:1.1] data with lines, data using 1:2 with lines, data
using 1:3 with lines, data using 1:4 with lines, data using 1:5 with lines,
data using 1:6 with lines, data using 1:7 with lines

I realise my code may be pretty dodgy but it does what i want. What i would
like to know now is how to change the negative half of the cycle to positive
as if rectified. multiplying by 1 doesnt seem to do it. I see there is an
ability to convert to unsigned (%u) but i'm not sure how to apply it and
even if it will do what i require.

Very grateful for any help,

Jimmy.

-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------
```
```

-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------

```