difference between t and t~

4 ビュー (過去 30 日間)
Yoshi Zn
Yoshi Zn 2016 年 11 月 5 日
編集済み: John D'Errico 2016 年 11 月 5 日
function s = powersin(x)
%POWERSIN Power series for sin(x).
% y = POWERSIN(x) tries to compute sin(x) from its power series.
s = 0;
t = x;
n = 1;
while s+t~= s;
s = s + t;
t = -x.^2/((n+1)*(n+2)).*t;
n = n + 2;
end
  1 件のコメント
John D'Errico
John D'Errico 2016 年 11 月 5 日
編集済み: John D'Errico 2016 年 11 月 5 日
Um, t~ does not exist in MATLAB. It is invalid syntax on its own. In fact, the characters "t~" only appear in your code in one place, in a test. There, the operator is ~= so the ~ is actually part of a test for inequality. It is not a separate operator applied to t in any way.
help ne
doc ne
I would strongly suggest that you start at the beginning. Read the beginning tutorials. Learn basic MATLAB syntax.

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

回答 (0 件)

カテゴリ

Help Center および File ExchangePerformance and Memory についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by