کد متلب (MATLAB) : مثال شماره 6
کدهای متلب :
clear all
close all
clc
% Script prepared by D. T. Valentine - September 2006.
%
% The question raised is: What range of angles, i.e.
% which of the four quadrants of the circle from 0 to
% 2*pi are the angular outputs of each of the functions?
%
% Determine the values of x to be examined:
%
x = -1:0.001:1;
%
% Compute the arc-functions:
%
y1 = acos(x);
y2 = asin(x);
y3 = atan(x);
%
% Convert the angles from radians to degrees:
%
y1 = 180*y1/pi;
y2 = 180*y2/pi;
y3 = 180*y3/pi;
%
% Plot the results:
%
plot(y1,x,y2,x,y3,x),grid,legend('asin(x)', 'acos(x)', 'atan(x)')
xlabel('\theta in degrees'),ylabel('x, the argument of the function')
%
% REMARKS: Note the following:
% (1) The acos(x) varies from 0 to 90 to 180 degrees.
% (2) The asin(x) varies from -90 to 0 to 90 degrees.
% (3) The atan(x) varies from -45 to 0 to 45 degrees.
%
% Stop
close all
clc
% Script prepared by D. T. Valentine - September 2006.
%
% The question raised is: What range of angles, i.e.
% which of the four quadrants of the circle from 0 to
% 2*pi are the angular outputs of each of the functions?
%
% Determine the values of x to be examined:
%
x = -1:0.001:1;
%
% Compute the arc-functions:
%
y1 = acos(x);
y2 = asin(x);
y3 = atan(x);
%
% Convert the angles from radians to degrees:
%
y1 = 180*y1/pi;
y2 = 180*y2/pi;
y3 = 180*y3/pi;
%
% Plot the results:
%
plot(y1,x,y2,x,y3,x),grid,legend('asin(x)', 'acos(x)', 'atan(x)')
xlabel('\theta in degrees'),ylabel('x, the argument of the function')
%
% REMARKS: Note the following:
% (1) The acos(x) varies from 0 to 90 to 180 degrees.
% (2) The asin(x) varies from -90 to 0 to 90 degrees.
% (3) The atan(x) varies from -45 to 0 to 45 degrees.
%
% Stop
نتیجه :
منبع کدها :
کتاب Essential MATLAB for Engineers and Scientists - صفحه 130 از فایل pdf کتاب
دسته بندی
انواع رسم شکل در متلب
نظرات 0 0 0