필터 지우기
필터 지우기

How can I get maximum and minimum value with sym variables

조회 수: 11 (최근 30일)
Gookki Jeong
Gookki Jeong 2020년 7월 30일
답변: madhan ravi 2020년 7월 30일
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.

채택된 답변

madhan ravi
madhan ravi 2020년 7월 30일
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.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by