How to reduce dimension of griddedinterpolant?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Konrad Warner
le 29 Juil 2020
Commenté : Konrad Warner
le 29 Juil 2020
I have a gridded efficiency map where each point depends on different input values for current and voltage.
F = griddedInterpolant(x_voltage,y_current,eff_map)
% and query points
eff = F(voltage_set,current_set)
Now I want to convert this map while runtime of a program to a curve for a fixed voltage, so that the efficiency just depends on the current/power.
Kind of,
function new_F = reduceDimension(F,fixed_voltage)
...
end
eff = new_F(power_set)
I can't find a quick solution, maby someone has an idea.
THX
0 commentaires
Réponse acceptée
John D'Errico
le 29 Juil 2020
Modifié(e) : John D'Errico
le 29 Juil 2020
whos
Name Size Bytes Class Attributes
eff_map 500x500 2000000 double
x_voltage 500x500 2000000 double
y_current 500x500 2000000 double
We are given some data as arrays, and you understand how to use griddedInterpolant. What you need to learn next is about building a function handle.
F = griddedInterpolant(x_voltage,y_current,eff_map)
Now, you want to reduce that, for a FIXED voltage, to a function of only one variable. Since 42 is the answer to everything, I'll fix the voltage at 42.
FixedVolts = 42;
F_v42 = @(y) F(repmat(FixedVolts,size(y)),y);
That is all it takes. We can now evaluate the new function at some value or a list of values for the current. We can even plot it as a function of one variable now. I've even set up F_42v in such a way that we can even pass in a complete vector or array for y. The result will be the same shape and size as the input for y.
F_v42(17)
ans =
0.881963765526607
F_v42([1 3 5])
ans =
0.0952082740655224 0.230322190630928 0.381508409480828
fplot(F_v42,[0,50])
xlabel 'y_current'
ylabel 'eff_map @ x = 42'
1 commentaire
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Matched Filter and Ambiguity Function dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!