MATLAB- for loop saving results of 3 variables

  • MATLAB
  • Thread starter Economist08
  • Start date
  • #1
MATLAB- for loop and interation

Hi
I'm using an interation method to solve for 3 variables in 3 non-linear equations. I would like to find out, how the 3 variables change, when I change a parameter in the 3 equations. Let's assume the parameter runs from 1 to 5 (1:1:5).

The iteration looks like this:
x0 = [1; 1; 1]; % Make a starting guess at the solution
options=optimset('Display','iter'); % Option to display output
[x,fval] = fsolve('file_that defines_the_3_functions',x0,options) % Call optimizer, where x is vector of the 3 variables

Preferable I would like to save the results in a 3*5 matrix, where n is the number variables and 5 the number of different parameters.
Please help!!!!

Thanks in advance.
 
Last edited:

Answers and Replies

  • #2
In the last sentence, I meant "where 3 is the number of variables...", not n.
 
  • #3
Is this question not clear? Please let me know, when I need to clarify the question. :smile:
 
  • #4
2
0
I have the same problem!!!!!
I know this was posted 3 years ago, so if you managed to solve the problem can you please share the solution???
Thank you!!!
 

Related Threads on MATLAB- for loop saving results of 3 variables

Replies
3
Views
6K
Replies
2
Views
1K
  • Last Post
Replies
1
Views
2K
  • Last Post
Replies
3
Views
11K
  • Last Post
Replies
3
Views
3K
  • Last Post
Replies
1
Views
1K
  • Last Post
Replies
7
Views
14K
  • Last Post
Replies
2
Views
37K
  • Last Post
Replies
5
Views
3K
Top