필터 지우기
필터 지우기

How to change code to user input parameter

조회 수: 1 (최근 30일)
Dejan Cvijanovic
Dejan Cvijanovic 2013년 9월 18일
I'm wanting to do some sensitivity analysis on some code (sytstem of ODEs, PDEs) and want the user to input a parameter. How would I do that for the existing code? The code would go something like this:
nom par=5; % set nominal parameter value
par=nom par; % assign nominal parameter value
[t nom, s nom]=ode45(ODEFUN,[0,Tend],s0); % nominal trajectory
s nom ss = s nom(length(t nom)); % steady-state concentration
delta=0.05; % set deviation (5 percent)
par=par*(1+delta); % perturbed parameter value
[t pert,s pert]=ode45(ODEFUN,[0,Tend],s0); % perturbed trajectory
s pert ss=s pert(length(t pert)); % steady-state concentration
abs sens=(s pert ss-s nom ss)/(delta*nom par); % absolute sensitivity
rel sens=abs sens*(nom par value/s nom ss); % relative sensitivity
Except for my code, I am calling a function that I want to have user input, and that code that I use it on is plotting some graphs. I have another code that has a bunch of ODE's...any ideas on how or what I should change?

답변 (2개)

Azzi Abdelmalek
Azzi Abdelmalek 2013년 9월 18일
Use input
help input

Image Analyst
Image Analyst 2013년 9월 18일
Try using inputdlg(). There is an example in the help.

카테고리

Help CenterFile Exchange에서 Boundary Conditions에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by