Triangular window


 
Thread Tools Search this Thread
Top Forums Programming Triangular window
# 1  
Old 12-01-2010
Triangular window

I want to code a triangular window in an array. The array size is an odd number and indices start from 1.

For example Having the number of elements N = 13

The middle position 7, the value will be 1.0 Then things decrease to zero using a rectangular variation.

Having problem how to code it.
# 2  
Old 12-01-2010
This is simple math. You solve this with algerbra, it's a line from (1,0) to (7,1).

Code:
# slope of the line
m = (y1-y2)/(x1-x2)
m = (1-0)/(7-1)
m = 1/6

# solve for b, by putting in x y m
y = mx + b
y - mx = b
1 - (1/6)7 = b
6/6 - 7/6 = b
b = -(1/6)

So, the line is y = (1/6)*x - (1/6)

# 3  
Old 12-01-2010
Got it Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Toggle between xterm window and standard terminal window

Is it possible to toggle back and forth between an xterm invoked from one tty, and a shell invoked from a different tty? I am running Centos 7 with KDE and booting in non-graphic mode. After logging in on the default window (/dev/tty1) , I can then use ALT-F2 to access a new window (/dev/tty2),... (1 Reply)
Discussion started by: rhgscty
1 Replies

2. Shell Programming and Scripting

Awk: Storing string in array(triangular form)

I have a string like below. Now i want to split this string like below and put the value in the array using awk. I am able to do it using bash but getting no clue for doing it in awk O/P A=0 A=01 A=014 A=0143 A=01438 A=014387 A=0143876 A=01438765 A=014387650 ... (7 Replies)
Discussion started by: siramitsharma
7 Replies

3. Shell Programming and Scripting

Lower triangular matrix

Hi, I was wondering if there is a way of using awk to extract the lower or upper triangular matrix from a symmetric matrix. Say I have this matrix: $ cat data: 1 0 9 6 7 9 0 8 2 8 9 0 9 2 6 9 4 3 6 8 9 6 9 4 7 9 4 9 9 7 9 0 3 4 7 9 I am trying to do two things. Result 1: 0 9 2 6 8... (4 Replies)
Discussion started by: iconig
4 Replies

4. HP-UX

How to start X window?

hi, here is a HP workstation C9000 with HP-UX system in my office. couple days ago we shutdown the system. when trying to turn the it on, the system failed to start X window. my boss ask me fix it, but i am new of unix world. please be kindly to teach me how to get error message and fix... (19 Replies)
Discussion started by: ethandaddy
19 Replies

5. Shell Programming and Scripting

awk - from arrays to lower triangular matrix

Hi, I have to reshape some ascii files. I have many ascii files that have collapsed the lower triangular of my matrix into row. I simply want to convert them back to the proper matrix form. So, my current data looks like this: 11 21 22 31 32 33 41 42 43 44 ... This is five columns of... (2 Replies)
Discussion started by: Viko Haestner
2 Replies

6. Red Hat

Maximizing X window without Window Switcher

Hi everyone! I have a strange situation. I'm running an NX remote Gnome desktop session. On the remote machine, there is a whole load of unsaved data in a window. A problem that I've been having with this NX session is that I can't load Gnome Applets, including the Window Switcher. So.. when I... (0 Replies)
Discussion started by: alexandicity
0 Replies

7. UNIX for Dummies Questions & Answers

X-Window help

I unloaded the KDM/KDE package and was starting it per instructions by first running a "xstart". My screen is blank and I don't know how to recover. Thanks. Tom (4 Replies)
Discussion started by: TJSexton
4 Replies

8. UNIX for Dummies Questions & Answers

*HELP* Exit X Window?

i am attempting to install video drivers... but the program tells me that i cant install them from terminal... stating that i must close out of the xWindow System... how can i get the plain old command line? Red Hat 9 (2 Replies)
Discussion started by: HMSS013
2 Replies

9. Windows & DOS: Issues & Discussions

window 2000 professional not pinging my window 98 system.

Hello, We someone help me resolve this problem. I have window 2000 professional, windows 98 and Unixware 7.0.1 on the network. I was able to establish connection with all. However, l was unable to ping window 98 from window 2000 professional. I was able to ping the window 2000 from the window... (10 Replies)
Discussion started by: kayode
10 Replies

10. Programming

about X-window

Please, recommend anyone books about programming for X-window. (0 Replies)
Discussion started by: serge
0 Replies
Login or Register to Ask a Question