フィルターのクリア

how to create a changing variable for fsolve?

3 ビュー (過去 30 日間)
Hana
Hana 2012 年 7 月 6 日
i want fsolve to calculate the output for different uc each time (increasing uc by 0.001 each time). each output from fsolve should be sent to a simulink model seperatly. so i set a loop to do so, but i believe that at the currenty constellation (if it will work)will just calculate 1000 different values? is there a way to send out the values seperately?
if not, how can i create a parameter uc. that goes from 0 to say 1000? i tried uc=0:0.1:1000, but again, the demension doen't seem to fit.
how do i create a function that takes the next element of a vector/matrix each time the function is called?
best regards

採用された回答

Walter Roberson
Walter Roberson 2012 年 7 月 6 日
編集済み: Walter Roberson 2012 年 7 月 6 日
function Result = f(YourArray)
persistent iteration_number
if isempty(iteration_number); iteration_number = 0; end
iteration_number = iteration_number + 1;
if iteration_number > numel(YourArray);
Result = [];
iteration_number = []; %reset for next cycle
return;
end
Result = some expression in YourArray(iteration_number)
end
Please also read the documentation for fsolve() as you cannot pass in parameters the way you do. Please see the section about parameterizing the function.
  5 件のコメント
Walter Roberson
Walter Roberson 2012 年 7 月 6 日
Write a Level 2 S function if necessary.
There is a lot about Simulink that I have not put together mentally yet, as I do not have access to it myself.
Hana
Hana 2012 年 7 月 8 日
thank you, i will try that. &thanks for taking time answering my questions :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSchedule Model Components についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by