i have a question that works backwards
정보
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
이전 댓글 표시
I have a set of values for F and a set of values for D.
When F and D are divided together they give a ratio that I have the answers to in variable X
so
X=F./(D.^5)
ex.
F =[
0.0026 0.0026 0.0026 0.0026 0.0027 0.0027 0.0027 0.0028 0.0028 0.0028]
D =[
0.9652 1.0160 1.0668 1.1176 1.1684 1.2192 1.3208 1.4224 1.5240 1.6256]
X=[0.0024 0.0019 0.0015 0.0012 0.0010 0.0007 0.0005 0.0003 0.0002]
I want code that tells me for which F and which D give me the known answer of X
댓글 수: 5
dpb
2019년 4월 28일
What if there isn't an exact match (with floating point even if is theoretically, may not be numerically but that's a different issue)?
So, what is the desired answer for the above example data set?
Image Analyst
2019년 4월 28일
It's possible there is no (F, D) pair that gives the desired X value. Look:
F = [0.0026 0.0026 0.0026 0.0026 0.0027 0.0027 0.0027 0.0028 0.0028 0.0028]
D = [0.9652 1.0160 1.0668 1.1176 1.1684 1.2192 1.3208 1.4224 1.5240 1.6256]
X = [0.0024 0.0019 0.0015 0.0012 0.0010 0.0007 0.0005 0.0003 0.0002]
X=F./(D.^5)
plot3(F, D, X, 'b*-', 'LineWidth', 2);
grid on;
xlabel('F', 'FontSize', 20);
ylabel('D', 'FontSize', 20);
zlabel('X', 'FontSize', 20);

Well, individually, however, the variables are monotonic so one could in theory interpolate which is what the crystal ball is saying the OP would want to do...but would be good to know just what is the desired result for sure...
yyaxis left
hLL=plot([F;X].');
ylabel('F, X')
yyaxis right
hLR=plot(D);
ylabel('D')
xlabel('Ordinal number');
legend([hLL;hLR],'F','X','D')

The attached data are lacking in significant digits for both D and F but even so, X is relatively smooth.
Omar Almahallawy
2019년 4월 29일
편집: dpb
2019년 4월 29일
dpb
2019년 4월 29일
That's a trivial Q? as posed; you calculated X_i from F,D_i so the answer is simply "i" for the set of calculated values.
IF you somehow generate the identically-computed X from some other location, then that Xprime value would match one of the originals; to find which one would be simply
indx=find(X==Xprime);
BUT as was noted in the previous comment, that exact lookup will fail almost certainly owing to floating point rounding and precision issues; perhaps ismember could help resolve that particular problem but somehow I don't think you've yet described what you're after sufficiently for us to understand what the objective is here.
답변 (1개)
Jos (10584)
2019년 4월 29일
What about
% X is known
F = X
D = ones(size(F))
% F ./ (D.^5) equals X
or is this to simply thought by me ;-)
댓글 수: 0
이 질문은 마감되었습니다.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!