interpolateSolution for a system of time dependent PDEs

Hello and sorry again if the question is silly.
I have a system of 2 PDEs. I solved them using the command:
res=solvepde(modelTwoDomain,tlist);
Solution in the nodes is:
sol=res.NodalSolution;
So far so good. Now is when I think I am being silly.
I want to interpolate the solution for a given point x=1.24 and y=1.22. They belong to the geometry of the model and I try to use interpolate solution.
I use: uxy = interpolateSolution(res,1.24,1.22);
and the following error comes up:
Error using pde.PDEResults.interpolateSolutionInternal
Incorrect number of input arguments.
Error in pde.TimeDependentResults/interpolateSolution (line 82)
uintrp = pde.PDEResults.interpolateSolutionInternal(obj,varargin{:});
What am I doing wrong?
Thanks

 Réponse acceptée

Torsten
Torsten le 17 Mai 2023
For a time-dependent solution, you must additionally specify the index of the output time for which you want to interpolate:
uintrp = interpolateSolution(___,iT) returns the interpolated values of the solution to the time-dependent or eigenvalue equation or system of such equations at times or modal indices iT. For a system of time-dependent or eigenvalue equations, specify both time/modal indices iT and equation indices iU

5 commentaires

Jorge Garcia Garcia
Jorge Garcia Garcia le 17 Mai 2023
Modifié(e) : Jorge Garcia Garcia le 17 Mai 2023
Thanks Torsted!
I am trying as you suggested (and I apologise as I am still quite new with Matlab, so I am sure I am doing something wrong)
If I write in command windows:
uintrp = interpolateSolution(res,1.24,1.22,5)
I should be solving for x=1.24; y=1.22 and time index 5
That gives the following error:
Error using pde.PDEResults.validatePointsMatrix
Query point matrix does not contain coordinates of 2-D space in required format.
Error using pde.PDEResults.validatePointsMatrix
Query point matrix does not contain coordinates of 2-D space in required format.
I have also try to pass position as vector (both as colum and row vector) and then the error is:
uintrp = interpolateSolution(res,Q,5)
Error using pde.PDEResults.interpolateSolutionInternal
Incorrect number of input arguments.
Error in pde.TimeDependentResults/interpolateSolution (line 82)
uintrp = pde.PDEResults.interpolateSolutionInternal(obj,varargin{:});
sorry about this, I admit I am a bit lost with Matlab
Read the documentation.
You say you solve two PDEs. Thus your call to "interpolateSolution" must have 5 arguments, not 4.
Thanks Torsten, for someone like me with not a lot of training in matlab, documentation is quite hard to understand. It is true that passing a fith argument, it returns a value. I will try to understand what is the meaning of the 5 arguments. Thanks again.
Torsten
Torsten le 17 Mai 2023
Modifié(e) : Torsten le 17 Mai 2023
The fourth is the index of the PDE, the fifth is the time index.
Look at the example
Interpolate Time-Dependent System
under
Thanks! you really saved my sanity!

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by