フィルターのクリア

The question is here http://i.i​mgur.com/E​kSTC0x.png​?1

376 ビュー (過去 30 日間)
Leonardo Concepcion
Leonardo Concepcion 2013 年 10 月 29 日
コメント済み: Leonardo Concepcion 2013 年 10 月 30 日
I need help to create this program, and I have to prepare this program for tomorrow, can't someone help me?
  4 件のコメント
Leonardo Concepcion
Leonardo Concepcion 2013 年 10 月 29 日
Leonardo Concepcion
Leonardo Concepcion 2013 年 10 月 29 日

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

採用された回答

sixwwwwww
sixwwwwww 2013 年 10 月 30 日
Dear Leonardo, here is the code for this problem:
x_deg = input('Input angle in degrees: ');
x = degtorad(x_deg);
sumTerms = 0;
n = 0;
E = Inf;
while E > 1e-6
a = ((-1)^n * x^(2 * n + 1)) / factorial(2 * n + 1);
prevSum = sumTerms;
sumTerms = sumTerms + a;
if n ~= 0
E = abs((sumTerms - prevSum) / prevSum);
end
n = n + 1;
end
fprintf('Value of sin(%0.1f) is: %0.5f\n', x_deg, sumTerms)
I hope it helps. Good luck!
  6 件のコメント
Leonardo Concepcion
Leonardo Concepcion 2013 年 10 月 30 日
Yes is better that way!!, thanks for your help :)
Leonardo Concepcion
Leonardo Concepcion 2013 年 10 月 30 日
And the rest of the script is ok?

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by