difference between t and t~

4 visualizzazioni (ultimi 30 giorni)
Yoshi Zn
Yoshi Zn il 5 Nov 2016
Modificato: John D'Errico il 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 Commento
John D'Errico
John D'Errico il 5 Nov 2016
Modificato: John D'Errico il 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.

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Performance and Memory in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by