필터 지우기
필터 지우기

matlab app designer input time dependent function

조회 수: 2 (최근 30일)
Marlon
Marlon 2023년 7월 3일
답변: Amit Dhakite 2023년 8월 9일
Hi everyone, I'm currently working on an app, in which you should be able to input a time dependent function in the app interface, for example 5*t as an input function for an ode45 integration.
Currently I'm using editfields, what only allows numerical values. Is there a way that i can put in a time dependent function in some kind of edit field for the usage of this function in the code?
  댓글 수: 3
Marlon
Marlon 2023년 7월 3일
Okay yes this should work, but the problem now is that the time value is always zero over the integration what leads to the Input funktion also being zero since it is multiplied by t. Maybe somebody got a hint oh this one?
Rik
Rik 2023년 7월 4일
Without showing example code and example inputs it is tricky to help you debug this.

댓글을 달려면 로그인하십시오.

답변 (1개)

Amit Dhakite
Amit Dhakite 2023년 8월 9일
Hi Marlon,
I understand that you would like to get a time dependent function as an input from the user which needs to be used for ode45 integration.
You can use “Text Area” to take the input of a time-dependent function. This input can then be converted into a string for evaluation. Once evaluated, it can be directly fed into the ode45 integration process.
For the issue regarding integration, you can:
  1. Make sure that the timespan over which you are integrating is correctly defined.
  2. Make sure that the user input is parsed and evaluated correctly.
A simple implementation to demonstrate this is attached here.
Hope this helps.

카테고리

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

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by