How to use interpolate struct data in simulink?
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Anup
el 16 de Feb. de 2023
Comentada: Fangjun Jiang
el 17 de Feb. de 2023
I have a struct data file in .mat format.
I can use interp2 to interpolate the data from this struct data file in matlab.
for example,
h = interp2(data.P,data.T,data.H,234e+05,317)
How to do similiar like this in simulink?
0 comentarios
Respuesta aceptada
Fangjun Jiang
el 16 de Feb. de 2023
Editada: Fangjun Jiang
el 16 de Feb. de 2023
In general, in Simulink, the "2-D Lookup Table" block can be used to do what interp2() does in MATLAB.
You need to figure out the proper size for the input arguments though. Your example certainly has problem due to un-matched size.
data.P=1:4;
data.T=1:3;
data.H=rand(3,4);
h = interp2(data.P,data.T,data.H,1.5,2.5)
data.P=rand(3,4);
data.T=rand(3,4);
h = interp2(data.P,data.T,data.H,0.5,0.5)
2 comentarios
Fangjun Jiang
el 17 de Feb. de 2023
My example should already explain it. If you want to run
h = interp2(data.P,data.T,data.H,234e+05,317), H is 301x400, then P needs to be 1x400 and T needs to be 1x301. See doc interp2
Más respuestas (0)
Ver también
Categorías
Más información sobre Event Functions 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!