Is there a way in MATLAB to guess the values of a matrix just like in the EES software?
5 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
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
y2 = fillmissing(y, 'spline', 'SamplePoints', x)
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 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.