필터 지우기
필터 지우기

How do I write the LHS code?

조회 수: 2 (최근 30일)
민제 강
민제 강 2021년 6월 11일
댓글: Ashutosh Singh Baghel 2021년 8월 31일
I want to get points through the LHS within the Rosenbrock function.
f(x)=100*(x2-x1^2)^2 + (1-x1)^2
x1^2 + x2^2 <= 1
Please let me know. Thank you!
  댓글 수: 1
Ashutosh Singh Baghel
Ashutosh Singh Baghel 2021년 8월 31일
Hi,
I beleive you wish to plot the 'Rosenbrock function '. Please refer to a simple example provided below.
x_int = [0 1];
y_int = [0 1];
[X Y] = meshgrid(linspace(x_int(1),x_int(2),150),linspace(y_int(1),y_int(2),150));
mask = X.^2 + Y.^2 <=1; %extracting points on grid where condition fails
X(~mask) = nan; %putting values of invalid x and y as nan
Y(~mask) = nan;
myFun = @(X,Y) (100*(Y-X.^2).^2 + (1 - X).^2); %creating function handle for equation of Rosenbrock function
mesh(X,Y,myFun(X,Y)); %plotting on mesh grid
var_values = myFun(X,Y); %extract the points within rosenbroke function
Please refer to the matlab documentation page for function handles.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by