Using fzero to find values of B for given values of A

1 回表示 (過去 30 日間)
Jamie Hobbs
Jamie Hobbs 2021 年 10 月 9 日
コメント済み: Matt J 2021 年 10 月 10 日
% i need ti find the values of B for given values of a: 5 10 15 20 25
% I was asked to used the function but I cant figure it out... any help would be apreciated
% this is the equations ((1-(0.5)*cos(A)-(1.2)*cos(B)))^2+((1-(0.5)*sin(A)+(1.2)*sin(B)))^2 -1 = 0
fun = @(B,A) ((1-(0.5)*cos(A)-(1.2)*cos(B)))^2+((1-(0.5)*sin(A)+(1.2)*sin(B)))^2 -1
A=5:5:25
x = fzero(fun,B,A)
  1 件のコメント
Jamie Hobbs
Jamie Hobbs 2021 年 10 月 9 日
correction this is the function
((1-(0.5)*cos(A)-(1.2)*cos(B)))^2+(((0.5)*sin(A)+(1.2)*sin(B)))^2 -1 = 0

サインインしてコメントする。

回答 (1 件)

David Hill
David Hill 2021 年 10 月 9 日
編集済み: David Hill 2021 年 10 月 9 日
A=5:5:25;
for k=1:numel(A)
fun = @(x) (1-0.5*cos(A(k))-1.2*cos(x)).^2+(0.5*sin(A(k))+1.2*sin(x)).^2 -1;
B(k)=fzero(fun,1);
end
  2 件のコメント
Jamie Hobbs
Jamie Hobbs 2021 年 10 月 10 日
Great Thanks!
Matt J
Matt J 2021 年 10 月 10 日
@Jamie Hobbs Please accept-click answers that address your posts.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeInterpolation についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by