jaejoon89
- 187
- 0
Using MATLAB, how do you evaluate a function at integer values, say 1 to 1000, of x and y? For simplicity, let's say the function is z = x + y.
The discussion focuses on evaluating a function in MATLAB over a specified range of integer values for variables x and y, specifically from 1 to 1000. Participants explore methods for implementing this evaluation, including both loops and matrix operations. Additionally, there is a request for assistance in constructing a specific matrix and vector pattern.
Participants present multiple methods for evaluating the function, indicating a lack of consensus on the preferred approach. The discussion on constructing the matrix and vector remains unresolved, with no responses yet addressing that specific request.
The discussion does not clarify the assumptions regarding the dimensions of the matrix A or the specific requirements for the vector v, leaving these aspects open to interpretation.
z = zeros(1000);
for x= 1:1000
for y = 1:1000
z(x,y) = x + y;
end
end
[x y] = meshgrid(1:1000);
z = x + y;