Skip to main content

Featured Post

The Ultimate Guide to Industrial V-Belt Drives: Selection & Tensioning

The Ultimate Guide to Industrial V-Belt Drives: Selection & Tensioning Figure 1: Not all black rubber bands are the same. Choosing the wrong profile is the #1 cause of slip. If you walk into a plant and hear a high-pitched "chirp" or smell burning rubber, you are witnessing wasted money. The industrial V-belt drive is the most common power transmission method, yet it is often the most misunderstood. Engineers often specify "A-Section" belts out of habit, ignoring modern, high-efficiency options. This guide covers Profile Selection , Length Calculation (with VBA) , and the critical belt tensioning method to eliminate belt squeal and premature failure. 1. The "Wedge" Effect: How it Works A flat belt relies purely on friction. A V-Belt relies on the Wedge Effect . As tension pulls the belt into the sheave groove, the side walls push outward, multiplying the normal force. Critical Rule: The belt should NEVE...
Disclosure: As an Amazon Associate, I earn from qualifying purchases.

Numerical Methods - First derivative using Excel VBA code

In the previous post, Numerical Methods - First derivative using Excel formula, we know how to calculate the first derivative of functions using formula in Microsoft Excel. In this post, let's see how we can simplify it by using Excel VBA code.

The VBA is just like this.

' ================================================
' Created by Suparerg Suksai
' Mechanical Design Handbook
' http://mechanical-design-handbook.blogspot.com
'
' First Derivative - Numerical Methods
' ================================================

Function f(x As Double) As Double
 
f = 5 * (x - 3) ^ 3 - 4 * x ^ 2 - Sin(2 * x)
End Function


Function fDeriv(x As Double) As Double
Const
h = 0.00001 ' Step size
fDeriv = (-f(x + 2 * h) + 8 * f(x + h) - 8 * f(x - h) + f(x - 2 * h)) / 12 / h
End Function


The highlighted (yellow) text is the function that we want to calculate for the first derivative. We can simply replace it with new function. The remaining code still remains the same.

We have to put this code into the Microsoft Visual Basic Editor in Microsoft Excel (Alt+F11). Now we're going to test this Derivative code. Because the first derivative of the function in this example can be determined by direct method. Then we can use it to recheck the calculation result.

The first derivative of 5(x-3)3-4x2-sin(2x) is 15(x-3)2-8x-2cos(2x). Therefore the first derivative of f(x) where x = 7 must be 15(7-3)2-8(7)-2cos(2(7)) = 183.7265256

Here how to use

In excel spreadsheet, enter =fDeriv(7) and see the result.



We'll use this First Derivative Function in the Newton-Raphson Root Finding Method later.

password: mechanical-design-handbook.blogspot.com
FREE DOWNLOAD EXAMPLE EXCEL FILE

Comments

Popular posts from this blog

Hoekens Linkage: Kinematics, Optimization, and Walking Robot Applications

Introduction to the Hoekens Linkage The Hoekens linkage is a specialized four-bar mechanism designed to convert rotational motion into an approximate straight-line motion. While it serves a similar purpose to other straight-line generators, its unique coupler curve—a "tear-drop" shape—makes it exceptionally useful for intermittent motion and walking machines. One of the most fascinating aspects of kinematic theory is the concept of "Cognates." The Hoekens linkage is actually a cognate linkage of the Chebyshev Straight-line Mechanism . This means that while the physical structure and link lengths differ, they can generate the exact same coupler curve geometry. Search for "Design of Machinery" Books Kinematics and Optimization Unlike the Watt linkage, which has a central pivot, the Hoekens linkage relies on a rotating crank to drive a floating coupler arm. The "straight" portion of the curve occurs when t...

The Engineer’s Guide to Precision Alignment: Dowel Pins, Diamond Pins & Fits

The Unsung Heroes of Precision: Dowel Pins & Locators In the world of Precision Engineering , the difference between a high-quality product and a scrap part often comes down to microns. While bolts hold parts together, they are terrible at positioning them. This is where Dowel Pins and Locating Pins become essential components in industrial tooling . What is a Dowel Pin? Dowel pins are precision-ground fasteners used to secure the relative position of two parts. They are typically machined to extremely tight tolerances (often within 0.0001 inches) and are available in materials like: Hardened Steel: For high-wear applications in CNC fixtures . Stainless Steel: For corrosion resistance in medical or food processing machinery. Plastic (Thermoplastic): For lightweight, non-conductive, low-load alignment. The "Play" Problem: Bolts vs. Dowels When mechanical design engineers create components, they cannot rely on bolts for alignm...

Ball Detent Torque Limiter: The Ultimate Guide to Precision Overload Protection

The First Line of Defense: Overload Clutches In high-speed automation and heavy industrial machinery, a "jam" is not a matter of if , but when . Whether it is a cardboard box getting stuck in a packaging machine or a tool crashing in a CNC lathe, the resulting torque spike can destroy gearboxes, twist shafts, and burn out expensive servo motors in milliseconds. A torque limiter (or overload clutch) is the mechanical fuse of the drive system. While electronic monitoring (current limiting) is common, it is often too slow to prevent physical damage from the massive kinetic energy stored in the system inertia. A mechanical torque limiter provides a physical disconnect that operates in a fraction of a second. Search for Torque Limiters & Safety Couplings Why Choose a Ball Detent Limiter? Not all torque limiters are created equal. In precision applications, the Ball Detent type is superior to friction or shear types for several reason...