Python में स्वागत है!

MATLAB उपयोगकर्ताओं के लिए Python

Justin Kiggins

Product Manager

पूर्वापेक्षा: MATLAB में मैट्रिसेस को बदलना

% Example of manipulating matrices in MATLAB

v = [16 5 9 4 2 11 7 14];
disp(v(5:end))

A = magic(4);
disp(A(2:4,1:2))

A(A>12) = 10;

disp(A(:,1))
MATLAB उपयोगकर्ताओं के लिए Python

पूर्वापेक्षा: MATLAB में plotting

% Example of plotting data in MATLAB
figure
plot(t,y,'b-')
xlabel('Time (s)')
ylabel('Sensor A')

figure
scatter(y1,y2,'go')
xlabel('Sensor A')
ylabel('Sensor B')

figure
histogram(y1,[0:0.01:1])
MATLAB उपयोगकर्ताओं के लिए Python

पूर्वापेक्षा: MATLAB scripts का control flow

% Example of control flow in MATLAB

fid = fopen('magic.m','r');
count = 0;
while ~feof(fid)
    line = fgetl(fid);
    if isempty(line) || strncmp(line,'%',1) || ~ischar(line)
        continue
    end
    count = count + 1;
end
count
MATLAB उपयोगकर्ताओं के लिए Python

अगर आप MATLAB नहीं जानते...

MATLAB उपयोगकर्ताओं के लिए Python

Python सिर्फ Data Science नहीं है

  • General purpose programming language
    • बड़े पैमाने के applications में machine learning models इंटीग्रेट करें
    • पब्लिक APIs से डेटा क्वेरी करें
    • ऐसी websites बनाएँ जो high traffic संभाल सकें
MATLAB उपयोगकर्ताओं के लिए Python

डेटा टाइप्स से शुरुआत

  • Integer
  • Float
  • Boolean
  • String
# Integer
x = 1

print(x)
type(x)
1

<class 'int'>

 

   

 

# Float
x = 1.0  
print(x)

type(x)
1.0

<class 'float'>
MATLAB उपयोगकर्ताओं के लिए Python

मैथमैटिकल ऑपरेटर्स

Operation Python Operator
Addition +
Subtraction -
Multiplication *
Division /
Exponentiation **
a = 3 + 12
print(a)
15
b = 4 * 5.0
print(b)
20.0
MATLAB उपयोगकर्ताओं के लिए Python

$ area = \pi r^2 $

radius = 5
pi = 3.14
area = pi * (radius ** 2)
print(area)
78.5

Warning: caret ऑपरेटर ^ का उपयोग न करें

# This won't take 4 to the second power
print(4 ^ 2)
# This is the bitwise XOR
6
MATLAB उपयोगकर्ताओं के लिए Python

चलिए शुरू करें!

MATLAB उपयोगकर्ताओं के लिए Python

Preparing Video For Download...