difference between t and t~

4 views (last 30 days)
Yoshi Zn
Yoshi Zn on 5 Nov 2016
Edited: John D'Errico on 5 Nov 2016
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 Comment
John D'Errico
John D'Errico on 5 Nov 2016
Edited: John D'Errico on 5 Nov 2016
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.

Sign in to comment.

Answers (0)

Categories

Find more on Performance and Memory in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!