Function output is returning equation not value
15 views (last 30 days)
Show older comments
Hi guys,
Im fairly new to MATLAB and im sure this is a quick fix...
I made a function to calculate the twist of a beam.
my last line of code is convertinf the answer in rad to degrees.
the fuction returns the devision the last line does not the value of the devision.
when I evaluate I get the correct answer. I want the function to just output the twist angle in deg.
Any ideas?
function P = twist(funky,A,B,G,Rinner,Router)
J = (pi/2)*(Router^4-Rinner^4); %calculate j in m^4
syms x;
t_x = int(funky,0,x);% intergrate internal tourqe function from 0 to x
pretty(t_x) %display intergration in nice format
T = int(t_x,A,B);%calculate intergral of t(x) dx and evaluate from A to B
rad = T/(G*J);% phi equation in rad
P = ((rad)*(180))/(pi);% convert red to deg
end
0 Comments
Answers (1)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!