How to do an equation for multiple variables and data?

I am tring to find the j polar momoment of inertia for mutliple hollow shafts:
or4=19.2
ir4=11.8
or5=18.8
ir5=12.2
or6=19.3
ir6=11.3
j4=(pi/2)*((or4)^4-(ir4)^4)
j5=(pi/2)*((or5)^4-(ir5)^4)
j6=(pi/2)*((or6)^4-(ir6)^4)
Is there a way I can perform these equations without having to repeatedly re-write the equations

 Accepted Answer

Like so
>> or = [19.2, 18.8, 19.3];
>> ir = [11.8, 12.2, 11.3];
>> j = (pi/2)*(or.^4 - ir.^4);
Notice .^ (ie dot^) not just ^

More Answers (0)

Categories

Find more on Numerical Integration and Differential Equations in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!