Borrar filtros
Borrar filtros

Importing data to a 2-D Lookup Table Simulink

5 visualizaciones (últimos 30 días)
Raymond Elliott
Raymond Elliott el 20 de Dic. de 2023
Comentada: Fangjun Jiang el 21 de Dic. de 2023
I have a 245x3 matrix where the first column represents the x values, the second column represents the y values, and the third column represents the z values (attaching data set below). My end goal is to interpolate this data using a 2-D Lookup Table in Simulink to get all the z values that exist in the range defined by the x and y values. I have used the unique function on the x and y values to define my breakpoints, but I am struggling on what to input for the table data. If I just input the column vector that contains the z values for table data, the output is only one dimensional. How can I use the information I have to create a 2D matrix of the z values that correlate to the x and y values?
I have tried to find good examples that are similiar to my case to no avail. Any help is greatly appreciated!
  2 comentarios
madhan ravi
madhan ravi el 21 de Dic. de 2023
Illustrate with an example.
Raymond Elliott
Raymond Elliott el 21 de Dic. de 2023
Apologies. Updated with some example images. Let me know if you need anything else!

Iniciar sesión para comentar.

Respuestas (1)

Fangjun Jiang
Fangjun Jiang el 21 de Dic. de 2023
Editada: Fangjun Jiang el 21 de Dic. de 2023
The data is not in the right shape to do this.
  1. There are too many duplicated (x,y) pairs. For the dupicated (x,y) pairs, the z values are significantly different. You have to decide which z value to represent for a particular (x,y) pair.
  2. After unique([x,y],'rows'), there are only 25 rows of data
  3. Yet, there are 25 unique values for x and 25 unique values for y
  4. To fill a 2-D lookup table for 25 values of x and 25 values of y, you need 25x25=625 z values.
  5. Think of a 2-D lookup table as an Excel sheet, first column is all the x values, first row is all the y values. The rest squre cells are filled with the z values.
  6. As long as you can fill or generate data for those squre cells. You can use the Simulink 2-D lookup table. Click the "Help" on the dialog to bring up the document and examples.
  7. Your plot is also not right. The unique (x,y) pairs all have the same values for x and y, like (-62,-62), (62, 62). So the points should be shown alone the diagnal line of the x-y plane.
  8. But fundenmentally, you need to fill more data for the x from -62 to 62, and y from -62 to 62 grids.
  2 comentarios
Raymond Elliott
Raymond Elliott el 21 de Dic. de 2023
I updated the data set. There should not be any duplicated (x,y) pairs, each entry should be unique.
So, are you suggesting that I need to interpolate the Z data first to complete the 25x25 matrix before using a 2-D lookup table?
Fangjun Jiang
Fangjun Jiang el 21 de Dic. de 2023
Yes, if you want to look up 25 values for x and 25 values for y.
Remember it is as if you lookup data on a paper. You find the row first, and then the column, and you find the value for that corresponding row and column.
Since you have the same grid value for x and y, you need to pay attention how the z values are arranged in rows and columns. I suggest you trying a simple example for x=[1 2 3] and y=[10 20] first if you never used the 2-D lookup table before.

Iniciar sesión para comentar.

Categorías

Más información sobre Nonlinearity en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by