value from graph
3 ビュー (過去 30 日間)
古いコメントを表示
theta= 0:.1:360
theta=deg2rad(theta)
w=B*d.*cos(theta)
AF=1/N*(sin(N*(w./2))./sin(w./2))
plot((theta),AF)
here i need the value of theta at at a poin of AF
i wrote that x(y(0.7)) in command window but it gives
"Empty matrix: 1-by-0"
how can i get the value of theta at y=0.7
0 件のコメント
回答 (1 件)
Matt Fig
2011 年 3 月 24 日
I am surprised you didn't get an error, indexing into y like that. What is y anyway, you don't define it. All I see is theta, w, and AF. And what are B,d and N? Also, why no semi-colons?
.
.
EDIT
I don't know why you would do that when you can just do this:
x = theta;
y = AF;
but anyway...
[mn,I] = min(abs(.7-y));
x(I)
Note that you are using a cyclical function, so there might be more than one value of y 'equal' to .7. If you want to get them all, use:
tol = 1e-6; % decide how close is close enough.
I = abs(.7-y)<tol
x(I)
5 件のコメント
Matt Fig
2011 年 3 月 24 日
@nitya
Well yes, everyone can see theta and AF defined. What we didn't see in your initial post are x, y, B, d, and N. Now we know what x and y are, but not the rest of the unknowns. Did you try the code?
Matt Fig
2011 年 3 月 24 日
@ Sean de
I thought of that too, but guessed y must be a variable given the context. It is still a mystery how that line didn't error.
参考
カテゴリ
Help Center および File Exchange で Matrix Indexing についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!