How to have consistent matrices in SSEST?

1 view (last 30 days)
I am trying to analyse the matrices in the State-Space format utilizing different sert of the same kinda of data, but with different starting conditions. However, when I check matrix A, it appears to display different formats (same size but different display). Is it any way of making sure we have consistant ones?

Answers (1)

Balavignesh
Balavignesh on 13 Oct 2023
Hi Luis,
As per my understanding, you would like to ensure consistent display formats for the matrix 'A'. I would suggest you try any of the below approaches:
  • You could use the 'fprintf' or 'sprintf' function to specify the display format during output. Note that 'fprintf' displays the matrix elements column-wise.
  • If you would like to perform further calculations or comparisons with the matrix 'A', you could convert it to a specific format using 'round' or 'roundn' to round the values to a desired precision.
%This is an example matrix.
A = [0.2, 0.33 ;0.444 ,0.56745];
fprintf('%0.4f\n', A); % Display A with 4 decimal places
0.2000 0.4440 0.3300 0.5675
B = [0.56 0.97623; 0.2 0.1234567];
B_rounded = round(B, 4); % Round A to 4 decimal places
disp(B_rounded)
0.5600 0.9762 0.2000 0.1235
Please have a look at the following documentation links to have more information on:
Hope that helps!
Balavignesh

Categories

Find more on MATLAB in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!