Asked by manoj saladi
on 6 Apr 2019

Hi,

I have a syntax in the form

id=gridfit(P,T,isd,P_v,T_v);

where P,T,isd are mxn matrices respectively and P_v,T_v are query points which are vectors of same order.

When I run the command its showing me warnings like shown below.

Warning: xnodes(1) was decreased by: 0.00034779, new node = 0.000706

Warning: xnodes(end) was increased by: 0.031914, new node = 0.10956

Warning: ynodes(1) was decreased by: 223.9438, new node = -223.5738

Warning: ynodes(end) was increased by: 98.383, new node = 223.5585

Warning: Rank deficient, rank = 1918702, tol = 4.754832e-06.

My P_v and T_v values doesn't actually start from zero. I suspect maybe this is a problem and I'm not sure.

Can anyone plz tell me what would be the exact problem?

Thanks in advance

Manoj.

Answer by John D'Errico
on 7 Apr 2019

Edited by John D'Errico
on 7 Apr 2019

Accepted Answer

No. There is no requirement about needing to start from zero. In fact, those were WARNINGS, not errors. It MAY indicate a problem in how you are trying to use gridfit. Hard to know.

Gridfit is a tool designed to fit a surface over some domain of points. You specify a grid of nodes, where it builds a lattice based on the grid you specify.

But suppose your data goes outside of the grid you give it? gridfit cannot then interpolate those data points that live outside of the lattice you specified. It cannot use those points, because they live in places beyond the grid.

There are several problems in those warnings. First, the question of why it had to expand the grid. For example, suppose you posed data to fit a surface to that varies from -100 to +100 in both x and y? But now you specify grid points that span only from 0 to 1?

I don't know what your data looks like. But it appears that you have created a severe mismatch of the gridded surface you want to build, compared to your data.

More important is the warning of rank deficiency. That problemly suggests your data has some serious problem in it. Perhaps you only supplied two data points, then wanted to build an entire surface. Or perhaps they all lie in a straight line. It is hard to know without seeing your data to be able to help you more.

John D'Errico
on 7 Apr 2019

My initial feeling that you are doing something wrong here is growing much stronger. You have data that initially is mxn in flux and torque.

current, which SHOULD be treated as an unknown "function", dependent on both flux and torque, is a vector of length m, so of size 1xm.

So you replicate current, until it is the same size as the other arrays. So now it is constant in one dimension. That means there really is no reason to use gridfit at all.

Eventually, you reshape each array, so they are 1xk, but why? You already do have a grid of points. So my guess is those arrays of dependent variable pairs, thus flux and torque, does not form a nice rectangular grid.

Regardless, the fact that you replicated rows of your dependent variable makes this into something that gridfit is not needed to solve at all.

Anyway, you are doing several things that seem to be mathematically problematic. As well, you still have a problem where you seem to have a problem in the data that I cannot really diagnose without actually seeing your data. It would be simplest if you attached a copy of your data to a comment using a .mat file. Or, if you do not wish to post your data online, then please contact me via e-mail, and you can send it that way.

manoj saladi
on 8 Apr 2019

Ok, let me be more clear. I derived two vectors, one of them is torque and the other one is flux.

These vectors should serve me as break points for 2d lookup tables in simulink. The table data in the lookup tables should be currents. But the problem is that the currents is not a matrix but a vector. So, my intention is to make this current vector into a matrix, so that I can use it as a table data in 2d lookup table with my derived torque and flux vectors as my break points. Like as in the picture below

I have currents as a vector from a data sheet and torque, flux as matrices, but I want to derive currents as a matrix based on the torque and flux vectors which I derived (not the one in data sheet). I felt like gridfit can derive the current as a matrix. Am I think in a wrong way?

Syntax: Current_matrix = gridfit(flux_datasheet, Torque_datasheet, currentvector_datasheet,flux_derived,torque_derived);

Thank you.

John D'Errico
on 9 Apr 2019

Sign in to comment.

Opportunities for recent engineering grads.

Apply Today
## 0 Comments

Sign in to comment.