# How make symbolic variables to a power equal to zero

5 visualizzazioni (ultimi 30 giorni)
Wojciech Kalinowski il 22 Mag 2021
Risposto: Paul il 24 Mag 2021
Hi,
I'm calculating inertia using thin strucuter theory. I have all of my components of inertial set as an symbolic array.
for example:
Iy_ = [16*t^3 / a, a^2 * t]
However, I need to equate any element in the array to 0 if the variable t is to an power greater than 1. So t^2, t^3, ... would equal zero where as t would remain as t.
Is there any convineint way to do this in MATLAB 2020a?
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposte (2)

Uday Pradhan il 24 Mag 2021
Hello,
I believe the below information will be helpful:
syms t;
sympol = 10 * t^2;
deg = numel(sym2poly(sympol)) - 1; %sym2poly extracts vector of all numeric coefficients, including zeros, from symbolic polynomial
if deg > 1
% evaluate sympol to 0
end
This way you can get the degree of the symbolic polynomial and then do the required computations. Documentation of sym2pol is here.
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

Paul il 24 Mag 2021
syms a t
Iy = [16*t^3 / a, a^2 * t]
Iy =
Iy(polynomialDegree(Iy,t)>1) = sym(0)
Iy =
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Categorie

Scopri di più su Formula Manipulation and Simplification in Help Center e File Exchange

R2020a

### Community Treasure Hunt

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

Start Hunting!

Translated by