how to get variable of function in for loop
Hello, someone please help me.
I created a polynomial function f(x,y) using two variables. I varied the values of both variables to get the maximum f(x,y) using for loop and i got it. But, i dont know how to get or display the values of the x and y that made it. can you tell me the syntax to get them? thanks!!
x = 1:20;
y = 1:13;
f = [];
for i = 1:length(x), j = 1:length(j);
f(i,j) = x(i).^2 – x(i) -2*y(j).^2 + y(j) -25;
end
fmax = max(max(f));
display(fmax)Hello, someone please help me.
I created a polynomial function f(x,y) using two variables. I varied the values of both variables to get the maximum f(x,y) using for loop and i got it. But, i dont know how to get or display the values of the x and y that made it. can you tell me the syntax to get them? thanks!!
x = 1:20;
y = 1:13;
f = [];
for i = 1:length(x), j = 1:length(j);
f(i,j) = x(i).^2 – x(i) -2*y(j).^2 + y(j) -25;
end
fmax = max(max(f));
display(fmax) Hello, someone please help me.
I created a polynomial function f(x,y) using two variables. I varied the values of both variables to get the maximum f(x,y) using for loop and i got it. But, i dont know how to get or display the values of the x and y that made it. can you tell me the syntax to get them? thanks!!
x = 1:20;
y = 1:13;
f = [];
for i = 1:length(x), j = 1:length(j);
f(i,j) = x(i).^2 – x(i) -2*y(j).^2 + y(j) -25;
end
fmax = max(max(f));
display(fmax) for loop, polynomial, variables, display MATLAB Answers — New Questions