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

3 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.
a=17;
t=16.05; % an array of 17 elements that are all 16.05
Duplicate j=1,a
tw[0,j]=t
tw[a+1,j]=tw[a,j]
tw[j,0]=tw[j,1]
tw[j,a+1]=tw[j,a]
end

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.
  2 Comments
Ahmet Emre
Ahmet Emre on 15 Jun 2022
Thanks.
Well, I was trying to use fillmissing to fill the missing values of an 19x19 matrix. But I only have the info for the first row. So, would it be possible to fill the remainder 18 rows?
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.
end
HTH
  5 Comments
Bjorn Gustavsson
Bjorn Gustavsson on 14 Jun 2022
Oviously there is no way that the full 2-D tw array is only filled in from the one line of the t array. Somewhere in the ESS-code the first and last two rows and columns of the tw-array are set and after that some operations are made. Exactly what is done I cannot tell from looking at an image with numbers. I could guess that it is some kind of solution to Laplace's equation with given boundary-conditions, but that's purely a guess. If that is the case there are functions to make that type of guess. For you to proceed further you'll have to figure out what ESS uses for this, then find the corresponding function in matlab.

Sign in to comment.

Categories

Find more on Matrices and Arrays in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!