I am trying to input my found critical point into the second derivative, but when I double it to get an actual value, I get an array of zeros.
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Oliver Ries
am 29 Feb. 2024
Kommentiert: Dyuman Joshi
am 5 Mär. 2024
Q = @(v) sym(v);
Pi = Q(pi);
E = Q(9.9)*10^6;
p = Q(.098);
F = Q(1500);
L = Q(20);
g = Q(32.2)*12;
I = (F*L^2)/(E*Pi^2);
syms R1 t
x = I == (Pi/4)*(((R1+t)^4)-(R1^4));
R = solve(x, R1, 'MaxDegree', 4);
W0 = 2.*Pi.*p.*L.*g.*t.*R;
dW = diff(W0,t)==0;
cp = arrayfun(@(F) vpasolve(F,t), dW(1), 'uniform', 0);
cp{1};
var = double(vpa(vpa(cp{1})));
ddW = diff(dW,t);
ddW_t = subs(ddW, t, var); % Substitute t with the value
number = double(ddW_t);
0 Kommentare
Akzeptierte Antwort
Dyuman Joshi
am 29 Feb. 2024
"... but when I double it to get an actual value, I get an array of zeros."
That is because dW is defined as an equation, not an expression.
You can change the definition to an expression and get the results accordingly -
Q = @(v) sym(v);
Pi = Q(pi);
E = Q(9.9)*10^6;
p = Q(.098);
F = Q(1500);
L = Q(20);
g = Q(32.2)*12;
I = (F*L^2)/(E*Pi^2);
syms R1 t
x = I == (Pi/4)*(((R1+t)^4)-(R1^4));
R = solve(x, R1, 'MaxDegree', 4);
W0 = 2.*Pi.*p.*L.*g.*t.*R;
%define dW as an expression
dW = diff(W0,t);
cp = arrayfun(@(F) vpasolve(F,t), dW(1), 'uniform', 0)
var = cp{1}
ddW = diff(dW,t)
ddW_t = subs(ddW, t, var) % Substitute t with the value
number = double(ddW_t)
3 Kommentare
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!