19
loading...
This website collects cookies to deliver better user experience
>> x=rand()
x =
0.8147
for i=a:b
c=d
end
for i in range(a,b):
#function
if a<b
a=b
elseif a>b
a=0
else
b=0
end
if a<b:
a=b
elif a>b:
a=0
else:
b=0
>> x=10;
>> if x<10
x=3
>> elseif x==10
>> x=pi
>> else
>> x=100
>> end
x =
3.1416
while condition
statement
end
while true
statement
end
>> for k=1:100
x=k;
while x>1
if mod(x,2)==0
x=x/2
else
x=3*x+1
end
end
end
Note that % operator in python is replaced by the mod() function in MATLAB mod(a,b) is equivalent to a%b
19