How to evaluate influence of 1 variable on a multi-variable function, keeping other variables constant?
Ältere Kommentare anzeigen
Hi!
I have a multi-variable function W=f(x1,x2,x3,x4,x5) and I want to study the influence of a single variable on the function outpup W, given the limits and step of the variable, and keeping other variables constant.
I want to store the results in a .txt file for futher processing and graphing.
Can you give me a function for this? I've tried using a for cycle but I haven´t got it yet.
Thank you very much for your attention.
2 Kommentare
Konstantinos Sofos
am 24 Mär. 2015
Could you make it more clear or give a specific example that you have? Do you look for something like this below:
f = @(x) x(1)+x(2)+x(3)+x(4)+x(5)
W = f([1,1,1,1,1])
e.g. playing with x1 values and record W?
John D'Errico
am 24 Mär. 2015
You are asking for someone to figure out what it is you want to do (apparently beyond a simple partial derivative) and then write your code. We should do this from a very sketchy description of your problem. The thing is, you know what you want. We don't know what is in your mind.
The virtue of a language like MATLAB is you can write your own code to do exactly what you want, thus effectively customizing the language to your particular needs and desires. But you need to write that code, as only you know your goals, exactly what it is you want.
Answers is not a site where you post a sketchy description of what you want and essentially advertise for someone to write it for you, hoping they will read your mind to get it right.
If you have code that does not do what you want, then post it and tell us what it does wrong and ask how to fix it.
If you have not gotten past a for loop, then you need to spend more time to learn MATLAB. The problem you have described has several steps to it. Break complicated problems down into simpler sub-problems that you know how to solve or can then learn to solve.
And finally, you probably need to learn to use functions. Writing code that dumps the results into a text file is a poor solution in general. Learn about functions that return a variable or variables that contain the desired results.
Antworten (0)
Kategorien
Mehr zu Optimization finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!