How to display all calculation results in Matlab

In summary, in order to display all calculation results in Matlab, the ODE solver must be evaluated at specific points in the interval of interest. The solver uses interpolation to generate a solution, which can then be evaluated at any desired point using xint and yint. Xint represents the points at which the solution is evaluated, while yint is the corresponding solution at those points.
  • #1
Ein Krieger
34
0
Hi,

How can I set Matlab to display all the calculation results?

I am solving the system of ODEs with large spatial variable and time step distribution. If I set total time to 100 with time step of 1 only the results starting from t=50 are displayed.

How to fix it?:frown:

Thanks.
 
Physics news on Phys.org
  • #2
The ODE solvers don't necessarily evaluate only at the points you specify. The most important time features that the solver looks at are the start point, end point, and distance between first two time steps.

They solve the whole system via interpolation.

So something like sol = ode45(@odefun,[t0,tf],y0,options) generates a solution and then you evaluate the solution at any point(s) you want with yint = deval(sol,xint)
 
  • #3
What do xint and yint stand for?
 
  • #4
kreil said:
The ODE solvers don't necessarily evaluate only at the points you specify. The most important time features that the solver looks at are the start point, end point, and distance between first two time steps.

They solve the whole system via interpolation.

So something like sol = ode45(@odefun,[t0,tf],y0,options) generates a solution and then you evaluate the solution at any point(s) you want with yint = deval(sol,xint)

What do xint and yint stand for?
 
  • #5
From the doc,

SXINT = deval(SOL,XINT) evaluates the solution of a differential equation problem at all the entries of the vector XINT. SOL is a structure returned by an initial value problem solver (ODE45, ODE23, ODE113, ODE15S, ODE23S, ODE23T, ODE23TB, ODE15I), a boundary value problem solver (BVP4C, BVP5C), or a delay differential equations solver (DDE23, DDESD). The elements of XINT must be in the interval [SOL.x(1) SOL.x(end)]. For each I, SXINT(:,I) is the solution corresponding to XINT(I).
 

1. How do I display all calculation results in Matlab?

To display all calculation results in Matlab, you can use the "disp" function. This function prints the value of the variable on the screen. For example, if you have a variable "x" with a value of 5, you can use the command "disp(x)" to print the value 5 on the screen.

2. Can I display all calculation results in a specific format?

Yes, you can use the "format" function to specify the format of the displayed results. For example, if you want to display all results in a fixed-point format with 2 decimal places, you can use the command "format short" before performing your calculations. This will change the default format of all displayed results.

3. How can I save all calculation results in a file?

To save all calculation results in a file, you can use the "diary" function. This function creates a diary file and records all the commands and outputs in the file. You can use the command "diary(filename)" to create the file and then perform your calculations. Once you are done, use the command "diary off" to stop recording and save the file.

4. Is there a way to display all results in a separate window?

Yes, you can use the "figure" function to create a new window for displaying your results. This function creates a new figure window where you can plot your results or display them using the "disp" function. You can also customize the size and appearance of the figure window using the different input arguments of the "figure" function.

5. How do I display all results in a table format?

To display all calculation results in a table format, you can use the "table" function. This function creates a table with the specified variables and their values. You can also customize the table by adding column names and formatting options. Alternatively, you can use the "fprintf" function to print a formatted table to the screen or a file.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
858
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
563
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
993
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
Back
Top