Is there a way in MATLAB to guess the values of a matrix just like in the EES software?

7 views (last 30 days)
In EES, there is something called "guess values", that is when an initial value is given, the software starts an iterative solution to guess the remaining values of a matrix or an array. Is there a way to (I know there must be one) do the same in MATLAB?
For example, I have a 19x19 matrix in EES, and in the software first row is given in the written code. Also, in the code it is entered as 19th column being equal to the 18th; 1st column being equal to 2nd; and 19th row being equal to 18th.
Edit: For example, in EES there is these lines that gives a guess value for tw matrix (19x19). Only the first row is known. Which is an array of same values.
t=16.05; % an array of 17 elements that are all 16.05
Duplicate j=1,a

Answers (2)

Steven Lord
Steven Lord on 14 Jun 2022
I'm not 100% certain but based on my understanding of your description I think the fillmissing function may be of interest to you.
x = 1:10;
y = x.^2;
y(5) = NaN
y = 1×10
1 4 9 16 NaN 36 49 64 81 100
y2 = fillmissing(y, 'spline', 'SamplePoints', x)
y2 = 1×10
1 4 9 16 25 36 49 64 81 100
This uses a piecewise cubic spline interpolation to try to fill in the missing value in the vector y. Since y was generated from a quadratic function, this was very successful. There are other fill methods available in case your data is not quite so "nice", see the documentation page for more information.
Bjorn Gustavsson
Bjorn Gustavsson on 15 Jun 2022
To the best of my understanding EES has information about the first and last columns of tw and the first and last rows of tw, somewhere.
From looking at some EES-documentation (eeshelp) the Duplicate-construct seems to be most similar to a standars for-loop in matlab. But what the EES is and what the variable-types it uses is not clear to me. Therefore what the corresponding operation would be in matlab is a fair bit unclear to me, perhaps it sometimes is identical, but sometimes ought to be combined with symbolic variables and techniques...

Sign in to comment.

Bjorn Gustavsson
Bjorn Gustavsson on 14 Jun 2022
You can easily initialize your variable to a fixed-valued array:
a = 17;
t = 16.05*ones([1,round(a)]);
If you want a function that makes these types of guesses write one:
function t = initialize_array(val,sz)
t = val*ones(sz); % you might want to make an n-by-1 or 1-by-n for a scalar sz input,
% but I leave that to you to modify.

Sign in to comment.




Community Treasure Hunt

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

Start Hunting!

Translated by