After running, the MysPow is displaying as NaN, any ideas as to why?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
KWatts = [100 500 900];
Ohms100 = [1.1900, 1.1845, 1.1776, 1.1746, 1.1797, 1.1925];
Ohms100Avg = median(Ohms100);
Ohms500 = [1.0272; 1.0292; 1.0243; 1.0212; 1.0235; 1.0241; 1.0249; 1.0245; 1.0208; 1.0167; 1.0194];
Ohms500Avg = median(Ohms500);
Ohms900 = [0.8770, 0.8730, 0.8721, 0.8676, 0.8668, 0.8675, 0.8681, 0.8661, 0.8637, 0.8617, 0.8597];
Ohms900Avg = median(Ohms900);
OhmsMys = [0.9694, 0.9770, 0.9762, 0.9814, 0.9846, 0.9839, .9932, .9928, .9919, .9954, .9964, .9870, .9841];
OhmsMysAvg = median(OhmsMys);
Ohms = [Ohms100Avg, Ohms500Avg, Ohms900Avg];
MysPow = interp1(KWatts, Ohms, OhmsMysAvg);
0 Kommentare
Antworten (1)
Walter Roberson
am 22 Apr. 2022
KWatts = [100 500 900];
Ohms100 = [1.1900, 1.1845, 1.1776, 1.1746, 1.1797, 1.1925];
Ohms100Avg = median(Ohms100);
Ohms500 = [1.0272; 1.0292; 1.0243; 1.0212; 1.0235; 1.0241; 1.0249; 1.0245; 1.0208; 1.0167; 1.0194];
Ohms500Avg = median(Ohms500);
Ohms900 = [0.8770, 0.8730, 0.8721, 0.8676, 0.8668, 0.8675, 0.8681, 0.8661, 0.8637, 0.8617, 0.8597];
Ohms900Avg = median(Ohms900);
OhmsMys = [0.9694, 0.9770, 0.9762, 0.9814, 0.9846, 0.9839, .9932, .9928, .9919, .9954, .9964, .9870, .9841];
OhmsMysAvg = median(OhmsMys);
Ohms = [Ohms100Avg, Ohms500Avg, Ohms900Avg];
MysPow = interp1(KWatts, Ohms, OhmsMysAvg);
numel(MysPow)
nnz(isnan(MysPow))
[min(KWatts), max(KWatts)]
[min(OhmsMysAvg), max(OhmsMysAvg)]
Your queiry position of 0.9846 is outside the range of index values for the input, 100 to 900. interp1() by default returns nan for values out of range.
If we examine the variable names, we would note that your index value is in kilowatts, and your dependent value is in Ohms, but your query value is in Ohms. Your query value needs to be in the same units as the corresponding index parameter, so kilowatts in this case.
If you want to use ohms values to look up kilowatt values, then the indexing vector (first parameter) would have to be ohms rather than kilowatts.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!