Filter löschen
Filter löschen

How can I get maximum and minimum value with sym variables

11 Ansichten (letzte 30 Tage)
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.

Akzeptierte Antwort

madhan ravi
madhan ravi am 30 Jul. 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.

Weitere Antworten (0)

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Produkte


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by