What is the "net slope"

In matlab doc, there is only "handling net slope computation".
I want to know meaning of "net slope", not method of dealing with net slope like above I said.
So, let me know the "net slope" itself.

2 Comments

Where? In which MATLAB doc, since there are thousands of pages of MATLAB docs?
I can start looking now, but I expect it to be weeks before I have read EVERY page of EVERY MATLAB doc.
When I type "net slope" at Matlab doc search blank to find out information about net slope, there is no knoweledge about net slope itself. There are just usages of it.

Sign in to comment.

 Accepted Answer

Andy Bartlett
Andy Bartlett on 21 Feb 2023
Edited: Andy Bartlett on 21 Feb 2023
Net slope is used in fixed-point operations to achieve agreement of scaling. The slopes of all the variables involved in an operation are combined into one multiplicative term called the net slope.
For example, multiply two variables with 10 bits to the right of the binary point and assign the product to a type with 12 bits to the right of the binary point.
The real world operation is
Vout = V1 * V2
The fixed-point scalings for these variables showing the slopes and stored integers are
Vout = (2^-12) * Qout
V1 = (2^-10) * Q1
V1 = (2^-10) * Q2
Via substitution we get
(2^-12) * Qout = (2^-10) * Q1 * (2^-10) * Q2
solving for the output stored integer and conslidating terms, we will see the Net Slope
Qout = (2^(-10-10+12)) * Q1 * Q2
NetSlope = 2^(-10-10+12) = 2^-8
In this case, the NetSlope can be perfectly represented in fixed-point. In fact, a simple shift right of 8 bits will efficiently achieve agreement of all the scalings.
The NetSlope gets more challenging when it is not an exact power of two.
Suppose the two inputs and the output had slopes of 6, 4, and 9 respectively. In that case, we have
NetSlope = (6*4)/9 = 8/3
To avoid costly division, this will get approximated with a fixed-point variable such as
format long g
fi(8/3,0,16)
ans =
2.66668701171875 DataTypeMode: Fixed-point: binary point scaling Signedness: Unsigned WordLength: 16 FractionLength: 14
The documentation of Rules of Arithmetic Operations gives more examples of computing net slopes

4 Comments

Thank you so much!
Um... I have a little difficulty in comprehancing meaning of "net"
May I ask you to explain it?
One meaning of "net" is "final."
You may be familiar with a business term like "net profit" which is the "final" profit after all the calculations with revenue and expenses are complete.
"net slope" is similar in spirit. Loosely speaking all the individual slope terms have been mathematically combined into one "final" value.
In the multiplication examples above, the three individual slope terms were combined into one "net slope."
Oh.. my ... god!!!
Thank you so~~~ much!!!! Andy!
Certainly, expert is different from ordinary people...
I'm not a guy in english culture, so it's hard to understand hidden meaning of any word.
They, just like you, always give me clearly and perfectly resolve my problem!
Thank you~!
Hello, Andy
I have one question in your example.
Why do we consider Qout instead of Vout?
Isn't Vout What we want to get finally?

Sign in to comment.

More Answers (0)

Categories

Find more on MATLAB Coder in Help Center and File Exchange

Asked:

on 21 Feb 2023

Commented:

on 3 Mar 2023

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!