Simplifying output involving heaviside discontinuity functions
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I wrote a program to find the discontinuity function of a beam. The output for the shear function was
f = (12*heaviside(x - 5/2) - 12*heaviside(x - 7/2))*x^2 + (84*heaviside(x - 7/2)...
- 60*heaviside(x - 5/2) - 24*heaviside(x - 1))*x + 75*heaviside(x - 5/2) - 12*heaviside(x - 1)...
- 109*heaviside(x - 7/2) + 46*heaviside(x)
How can the output be simplified so that there are no terms such as heaviside(x - 7/2)*x^2 where the heaviside function is shifted to the right by 7/2 but the function the heaviside function is multiplied by is not shifted by the same amount? For example, the above function is equivalent to
f = 46*heaviside(x)- 36*heaviside(x-1) - 24*heaviside(x-1).*(x-1) + 12*(heaviside(x-2.5).*(x-2.5).^2...
- heaviside(x-3.5).*(x-3.5).^2)+38*heaviside(x-3.5).*(x-3.5)
0 Kommentare
Antworten (1)
Amish
am 14 Mai 2024
Hi Aleem,
I see that you want to simplify the output so that there are no heavyside functions.
In order to do so, you will need to express each term in a way that aligns the multiplication of Heaviside functions with their respective polynomial terms, ensuring that the shifts in the Heaviside functions correspond directly to the shifts in the polynomial expressions they multiply.
Therefore, to simplify such expressions, you can use the "Symbolic Math Toolbox" which has the "simplify" function. However, you should keep in mind that the symbolic computation can be computationally intensive, and the ability of the "simplify function to reduce an expression to a form that matches your exact needs might vary. You may need some sort of manual manipulation based on mathematical insight to achieve the desired form.
Here is a general snippet of how to use the simplify function:
syms x
% Define the original function using Heaviside functions
f = (12*heaviside(x - 5/2) - 12*heaviside(x - 7/2))*x^2 + ...
(84*heaviside(x - 7/2) - 60*heaviside(x - 5/2) - 24*heaviside(x - 1))*x + ...
75*heaviside(x - 5/2) - 12*heaviside(x - 1) - 109*heaviside(x - 7/2) + 46*heaviside(x);
f_simplified = simplify(f);
f_collected = collect(f_simplified, heaviside(x));
% Display the simplified function and the collected form
disp(f_simplified)
disp(f_collected)
For more information you can refer to the following links:
Formula Manipulation and Simplification: https://www.mathworks.com/help/symbolic/formula-manipulation-and-simplification.html
Hope this helps!
0 Kommentare
Siehe auch
Kategorien
Mehr zu Symbolic Math Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!