Showing posts with label signal to noise ratio. Show all posts
Showing posts with label signal to noise ratio. Show all posts

Saturday, April 11, 2026

TI-95 PROCALC Programs

TI-95 PROCALC Programs



Here’s to another year with blog! Thank you everyone for your support.








Volume and Surface Area of a Cylinder



volume = π * r^2 * h

surface area = 2 * π * r * (h + r)



Program name: CYL (064 bytes)

‘RADIUS?’ BRK STO R

x^2 * ‘HEIGHT?’ BRK STO H

* PI = STO V ‘VOL=’ COL 16 MRG V BRK

2 * PI * RCL R * (RCL R + RCL H ) = STO A

‘AREA=’ COL 16 MRG A HLT



Example:

Example 1: RADIUS = 18.88, HEIGHT = 19.09

Result: VOL= 21377.64107, AREA= 4504.249671



Example 2: RADIUS = 17, HEIGHT = 9

Result: VOL= 8171.282492, AREA= 2777.167906



Engine Displacement of a Single Cylinder (automobile engine)



displacement = π ÷ 4 * bore^2 * stroke



Program: DSP (32 bytes)

‘BORE?’ BRK x^2 *

‘STROKE?’ BRK * PI / 4 =

‘DISP=’ COL 16 MRG = HLT



Example:

Example 1: BORE = 3.5 in; STROKE = 1.9 in

Result: DISP = 18.28014225 in^3



Example 2: BORE = 3 in; STROKE = 2.4 in

Result: DISP = 16.96460033 in^3



Magnetic Force



F = I * B * L * sin(Θ)



I: current in amps

B: density in Telsa

L: length of the conductor in meters

Θ: angle of the field in degrees

F: magnetic force in Newtons



Program: MGF (32 bytes)

INV DRG ‘ANGLE?’ BRK SIN *

‘L?’ BRK * ‘B?’ BRK * ‘I?’ BRK =

‘F=’ COL 16 MRG = HLT



Examples:

Example 1: Θ: 30°, L: 1.2 m, B: 0.7 T, I: 4 A

Result: F: 1.68 N



Example 2: Θ: 24°, L: 1.8 m, B: 0.7 T, I: 4.4 A

Result: F: 2.254947949 N



Note: INV DRG sets Degree mode



Signal to Noise Ratio



This program calculates signal to noise ratio based on the units used:



Decibels: SNR = S – N

Watts: SNR = 20 * log(S ÷ N)

Voltage: SNR = 10 * log(S ÷ N)



Program: SNR (120 bytes)

‘SIGNAL-NOISE’ PAU CLR

‘S?’ BRK STO S

‘N?’ BRK STO N

‘UNITS?’

DFN F1:DB @ 01

DFN F2: W @ 02

DFN F3: V @ 03

HLT

LBL 01 RCL S – RCL N = GTL 00

LBL 02 ( RCL S / RCL N ) LOG * 20 = GTL 00

LBL 03 ( RCL S / RCL N ) LOG * 10 = GTL 00

LBL 00 ‘SNR=’ COL 16 MRG = DFN CLR HLT



Notes:

Function labels have three characters, add spaces when necessary.

The colon and at sign are added automatically.



Examples:

Example 1: S: -20 db, N: -70 db

Result: SNR = 50



Example 2: S: 128 W, N: 25 W

Result: SNR = 14.18539922



Example 3: S: 76 V, N: 3.5 V

Result: SNR = 13.36745548



Eddie


All original content copyright, © 2011-2026. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.


Sunday, April 25, 2021

HP 12C: Statistical Signal to Noise Ratio

HP 12C:   Statistical Signal to Noise Ratio


Introduction and The Formula


There are many parameters that can be used to measure signal to noise ratio.   Today's formula will concentrate on the statistical measurements of univariate (1-variable) data.  The signal to noise ratio (SNR) is defined as the inverse of the ratio of the coefficient of variation, or the ratio of the mean to deviation.


SNR = mean / deviation


In the sources listed below (see the Sources section), they define the ratio as:


SNR = mean / standard deviation


However, the sources define standard deviation as:


√( ∑(x_i - mean for i = 1 to n) / (1 - n )


This is the formula for sample standard deviation, and that is the deviation this program will use.


HP 12C Program:  SNR


STEP KEY     KEY CODE

01 x-bar 43, 0

02 STO 0 44, 0

03 s         43, 48

04 RCL 0 45, 0

05 x<>y 34

06 ÷         10

07 GTO 00         43, 33, 00


Notes:


1.  x-bar displays the mean for both x and y data in their respective stacks.  Since we are only interested in the x data, I had to store the mean in R0.

2.  Similarly, calling up the s function displays the standard deviation for both x and y. 

3.  In statistics, only certain registers are available for storing values.  The HP 12C stores the following calculations during statistics:  R1: n,  R2: ∑x, R3: ∑x^2, R4: ∑y, R5: ∑y^2, R6: ∑xy.  


Instructions


1.  Clear the statistical data registers by pressing [ f ], [ SST ].

2.  Enter the data by using [ ∑+ ].

3.  Run the program by pressing [ R/S ].


Examples


Note:  The HP 12C is set to Fix 4 mode for these examples.  


Example 1: 

Data:  10, 35, 76, 49, 52, 56

SNR:  2.0883

(Mean:  46.3333,  Sample Standard Deviation:  22.1871)


Example 2:

Data:  50, 30, 20, 35, 25

SNR:  2.78000

(Mean:  32.0000,  Sample Standard Deviation: 11.5109)


Sources


BYJU'S  "Signal to Noise Ratio Formula"  BYJU'S Classes. 2021. https://byjus.com/signal-to-noise-ratio-formula/  Last Retrieved March 23, 2021  


EasyCalculation.com  "How to Calculate Signal to Noise Ratio (SNR) - Tutorial" https://www.easycalculation.com/statistics/learn-signal-to-noise-ratio.php Last Retrieved March 23, 2021


Wikipedia  "Signal-to-noise" https://en.wikipedia.org/wiki/Signal-to-noise_ratio  Retrieved February 27, 2021


Eddie


All original content copyright, © 2011-2021.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 


Python in Numworks: Duplicating and Grayscale

Python in Numworks: Duplicating and Grayscale All three scripts presented today use the math, random, and the Numworks specific ...