Azzera filtri
Azzera filtri

How can I get maximum and minimum value with sym variables

11 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

madhan ravi
madhan ravi il 30 Lug 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.

Più risposte (0)

Categorie

Scopri di più su Programming in Help Center e File Exchange

Prodotti


Release

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by