difference between t and t~

4 Ansichten (letzte 30 Tage)
Yoshi Zn
Yoshi Zn am 5 Nov. 2016
Bearbeitet: John D'Errico am 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 Kommentar
John D'Errico
John D'Errico am 5 Nov. 2016
Bearbeitet: John D'Errico am 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.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Performance and Memory finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by