How can I get maximum and minimum value with sym variables

24 vues (au cours des 30 derniers jours)
Gookki Jeong
Gookki Jeong le 30 Juil 2020
clear; clc; close all;
syms seta
gamma = 1;
Rx_ = 1;
Ry_ = Rx_*gamma;
% 등가 정적 적용
gamma = 1;
Rx1= ( cos(seta)-0.3*sin(seta) )*Rx_ ;
Rx2= ( cos(seta)+0.3*sin(seta) )*Rx_;
Rx3= ( 0.3*cos(seta)-sin(seta) )*Rx_;
Rx4= ( -0.3*cos(seta)-sin(seta) )*Rx_;
Ry1= (0.3*cos(seta) + sin(seta) )*Ry_;
Ry2= (-0.3*cos(seta) + sin(seta) )*Ry_;
Ry3= (cos(seta) + 0.3*sin(seta) )*Ry_;
Ry4= (cos(seta) - 0.3*sin(seta) )*Ry_;
N=4;
for ii=1:N
temp=['RR',num2str(ii),'=Rx',num2str(ii),'+Ry',num2str(ii),';'];
eval(temp);
end
here is my code, then I get
RR1 =
(13*cos(seta))/10 + (7*sin(seta))/10
RR2 =
(7*cos(seta))/10 + (13*sin(seta))/10
etc.
and now I want to get the max and min value and seta value at that point. but I don't know how I get it. the max(), min() didn't work for syms funtion.

Réponse acceptée

madhan ravi
madhan ravi le 30 Juil 2020
Use matlabFunction() and fminbnd() to find the minimum value of that function and to find the maximum extreme use negative sign for the function and feed it to fminbnd().
doc matlabFunction
doc fminbnd
And as always eval() here is completely not necessary and should be avoided.

Plus de réponses (0)

Catégories

En savoir plus sur Programming dans Help Center et File Exchange

Produits


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by