difference between t and t~

4 次查看(过去 30 天)
Yoshi Zn
Yoshi Zn 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 CenterFile Exchange 中查找有关 Performance and Memory 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by