Filter löschen
Filter löschen

How do I write the LHS code?

2 Ansichten (letzte 30 Tage)
민제 강
민제 강 am 11 Jun. 2021
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 Kommentar
Ashutosh Singh Baghel
Ashutosh Singh Baghel am 31 Aug. 2021
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.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Chemistry finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by