Support with interpolation using interp3 in MATLAB
8 views (last 30 days)
Show older comments
Hello!
In the pursuit of creating two characteristic fields for the phase current and power factor of a system, the following input variables are available: voltage, torque, and speed. Two reference points have been identified at 580 V and 650 V, along with the corresponding values for torque (10 Nm and 20 Nm) and speed (1000 RPM and 1500 RPM).(example values for torque and speed!)
The objective is to interpolate the values for the phase current and power factor at various points between these reference points. The intention is to utilize the interp3 function to calculate the phase current and power factor for different combinations of the input variables. A question arises regarding whether to establish target values or to use the reference points as target values.
Another concern is to avoid manual grid definition. An automated interpolation of the values is desired to achieve a clear representation of both characteristic fields that can be overlaid. This approach aims to enhance the understanding of the system's behavior in relation to voltage, torque, and speed.
Any suggestions or tips regarding the use of interp3 and the best practices for interpolation in this context would be greatly appreciated.
Thanks in advance.
0 Comments
Answers (2)
John D'Errico
on 14 Oct 2024
Edited: John D'Errico
on 14 Oct 2024
And ... your question about MATLAB is? Far too much vague verbiage to know what is the problem. If you want to know how to use interp3, then READ THE DOCS! In this case interp3 will be what you need to read. You will find examples of use in there.
However, it apears you have only TWO (2) levels for each variable. If that is true, then only 'nearest' or 'linear' interpolation are your options for a method. The linear interpolation method employed is sometimes known as "trilinear" interpolation.
Actually, linear interpolation in higher dimensions has the confusing issue that it is not truly linear depending on your point of view, and so there are multiple methods that might be employed, and still be considered to be linear. But interp3 uses the trilinear interpolant described in that link.
If you really have multiple points in each dimension despite what you have said, then higher order methods can be employed. Since you indicate exactly 2 levels, I can only assume the little you did say would be the truth.
You say that a question arises about target values or reference points, but again, far too vaguely stated. And what in your mind is a target value versus a reference point?
Best practices for interpolation? That just comes down to understanding what interpolation is, what it does and what it does not do. There are a million things you can do wrong, and we have seen them all done at some time or another. So the best practice for interpolation is to understand it. Do some reading. I suppose you could start here:
but really, entire texts have been written on the topic.
0 Comments
Hitesh
on 15 Oct 2024
Hi Z,
To interpolate the phase current and power factor using the provided reference points for voltage, torque, and speed. It involves defining reference points and creating a 3D grid for voltage, torque, and speed.You can perform interpolation over a new grid to estimate values at new points. Finally, the interpolated data is visualized with contour plots to analyse the phase current and power factor at a specific speed, kindly follow these steps :
- Define Reference Points: Specify three ranges, each containing two points for voltage, torque and speed.
% Define the reference points
voltage_range = [580, 650]; % Two points for voltage
torque_range = [10, 20]; % Two points for torque
speed_range = [1000, 1500]; % Two points for speed
- Create a Grid: You can use "meshgrid" function to create a 3D grid (V, T, S) based on the defined voltage, torque, and speed ranges.
% Create a grid using meshgrid
[V, T, S] = meshgrid(voltage_range, torque_range, speed_range);
- Reference Data: then you can define two 2x2x2 matrices "phase_current_ref" and "power_factor_ref", which represent example output values at the reference points.
% Example output values at reference points (2x2x2 matrix)
% Replace these with actual measured or calculated data
phase_current_ref = cat(3, [5, 6; 7, 8], [5.5, 6.5; 7.5, 8.5]); % 2x2x2 matrix
power_factor_ref = cat(3, [0.8, 0.85; 0.9, 0.95], [0.82, 0.87; 0.92, 0.97]); % 2x2x2 matrix
- Define New Points for Interpolation: You would need to create New sets of points as per requirements.
- Create a New Grid for Interpolation: A new 3D meshgrid ("V_new", "T_new", "S_new") can be created using the new sets of points.
- Interpolate Phase Current and Power Factor: "interp3" is used to interpolate the phase current values over the new grid. Similarly you can interpolate new grid for power factor.
% Interpolate phase current
phase_current_interp = interp3(V, T, S, phase_current_ref, V_new, T_new, S_new, 'linear');
- Visualization: A slice of the interpolated data at a specific speed index is visualized using "contourf" plots.The first subplot visualizes the interpolated phase current.Similary generate the subplot for interpolated power factor.
% Visualize the results
speed_index = 1; % Choose a slice index for visualization
figure;
subplot(1, 2, 1);
contourf(V_new(:,:,speed_index), T_new(:,:,speed_index), phase_current_interp(:,:,speed_index));
title('Phase Current');
xlabel('Voltage (V)');
ylabel('Torque (Nm)');
For more information on "meshgrid", "cat" and "interp3" function, refer to below MATLAB documentation:
Hope this help!
0 Comments
See Also
Categories
Find more on Interpolation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!