۱ مطلب با کلمه‌ی کلیدی «#مشتق» ثبت شده است

math commands

دستورات ریاضی:

.
مشتق

.

مثال اول:
clc ; clear ; close all

syms x a
f=sin(a*x);
diff(f)

.

.

مثال دوم:

%% the third derivative of function as(a)
clc ; clear ; close all

syms x a
f=sin(a*x);
diff(f,a,3)

.

.

مثال سوم:

%% Multivariate function in terms of a specific variable
clc ; clear ; close all

syms x y
f=x^2 + y^2;
g=diff(f,y)

.

.

دیفرانسیل

.

مثال اول:

% x''+2x'+x=1
clc ; clear ; close all

dsolve('D2x+2*Dx+x=1')

.

مثال دوم:

% xy'+1=y
clc ; clear ; close all

w=dsolve('x*Dy+1=y','x')
ezplot(w)

.

مثال سوم:

% y''-2y'+y=xe^x+4
clc ; clear ; close all

w=dsolve('D2y-2*Dy+y=x*exp(x)+4','y(0)=1','Dy(0)=1','x')
ezplot(w)

.

.

انتگرال

.

مثال اول:

clc ; clear ; close all

syms x
int(4*x^3,x)

.

مثال دوم:

%% quad(y,min,max)
clc ; clear ; close all

y='sin(x)';
z=quad(y,0,pi)

.

مثال سوم:

%% multiple integral
clc ; clear ; close all

syms x y
int(int(x^2+y^2,y,0,sin(x)),0,pi)

.

.

حد:

.

مثال اول:

%% lim x->0 (sinx/x)
clc ; clear ; close all

syms x
limit(sin(x)/x,x,0)

.

مثال دوم:

%% lim x->inf (x^3-x^2+x)/(5*x^3-3)
clc ; clear ; close all

syms x
limit((x^3-x^2+x)/(5*x^3-3),x,Inf)

.

.

سیگما:

.

مثال اول:

%% symbolic plural

% 5 , k=0 (k^3)
clc ; clear ; close all

syms k
symsum(k^3,0,5)

.

مثال دوم:

%% inf , x=1 (1/x^2)
clc ; clear ; close all

syms x
symsum(1/x^2,1,Inf)

.

مثال سوم:

%% n , k=1 (1/k-1/k+1))
clc ; clear ; close all

syms k n
symsum(1/k-1/(k+1),1,n)

.

.

ماتریس:

.

clc ; clear ; close all

A=[1 2 3;4 5 6;7 8 9]

a=A' %transpose

b=ndims(A) %returens the number of dimensions in the array A

c=size(A)%returens the size of the dimension

d=sort(A)%sorts the elements

e=det(A)%returens the determinant of square matrix A

f=inv(A)%computes the inverse of squre matrix A

g=pinv(A)%returens the Moore-Penrose Pseudoinverse of matrix A

h=rank(A)%returens the rank of matrix A

j=prod(A)%returens th product of the array elements of A

k=min(A)%is a row vector containing the minimum value of each column of A

l=max(A)%is a row vector containing the maximum value of each column of A

.

%% scalar operations
clc ; clear ; close all

A=[5 6 7]
B=[3 8 4]

a=A+B
b=A-B
d=A/B
e=A * B

%%
clc ; clear ; close all

A=1:2:10
A(:,2) %second coloun
sum(A(:)) %matrix sum

.

%% special matrices
clc ; clear ; close all

zeros(3,3)
ones(3,3)

eye(3,3)
rand(3,3)

.

.

دنباله فیبوناچی:

.

% Calculate the Fibonacci sequence
n =input('Enter the number terms: ');
fib=zeros(1,n);
fib(1) = 0;
fib(2) = 1;
for i = 3:n
fib(i) = fib(i-1) + fib(i-2);
end
disp(fib)

.

.

فاکتوریل:

.

%with for
n = input('Enter a non-negative integer: ');
factorial = 1;
for i = 1:n
factorial = factorial * i;
end
fprintf('The factorial of %d is %d.\n', n, factorial)

.

.

%% with while
n = input('Enter a non-negative integer: ');
factorial = 1;
i = 1;
while i <= n
factorial = factorial * i;
i = i + 1;
end
fprintf('The factorial of %d is %d.\n', n, factorial)

۰ ۰ ۰ دیدگاه


تبلیغات
Blog.ir بلاگ، رسانه متخصصین و اهل قلم، استفاده آسان از امکانات وبلاگ نویسی حرفه‌ای، در محیطی نوین، امن و پایدار
bayanbox.ir صندوق بیان - تجربه‌ای متفاوت در نشر و نگهداری فایل‌ها، ۳ گیگا بایت فضای پیشرفته رایگان
Bayan.ir - بیان، پیشرو در فناوری‌های فضای مجازی ایران