Help, how to replace the values of a ones matrix with vectors in each column

1 次查看(过去 30 天)
Hi, i'm resolving a PDE for three components (diffusion problem). The things is, i want to save those values of concentration in the domain of x in the end of the simulation in a 100 x 3 ones matrix (one column for each component). As the concentration values are time dependent, while t<t of simulation, the values varies, but when the time is over, all the values return to one. I'm solving the PDE separately for each component, so i'm using an if sentence to replace the values of the matrix for the concentration values. How can i keep the last concentration values of all the components in the matrix, so they don't return to be one? I hope you can understand my problem

回答(1 个)

Sreedhar Arumugam
I am assuming you are solving a PDE in 1 dimension. You can check out MATLAB's PDE solver which returns the solution as a 3-D array sol, where sol(i,j,k) contains the kth component of the solution evaluated at t(i) and x(j).
You can read more about solving one-dimensional PDE's in MATLAB here :
In case your problem is of a higher dimension (such as 2-D or 3-D), I would suggest you to check out the Partial Differential Equation Toolbox.

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by