کد متلب (MATLAB) : مثال شماره 15
کدهای متلب :
clear all
close all
clc
% Source of data: Economic Report of the President, 1986.
cpi_data = [1.7 2.9 2.9 4.2 5.4 5.9 4.3 3.3 6.2 ...
11.0 9.1 5.8 6.5 7.7 11.3 13.5];
perc_unemploy_data = [4.5 3.8 3.8 3.6 3.5 4.9 5.9 ...
5.6 4.9 5.6 8.5 7.7 7.0 6.0 5.8 7.0];
year_strings = ['1965';'1966';'1967';'1968';'1969';...
'1970';'1971';'1972';'1973';'1974';...
'1975';'1976';'1977';'1978';'1979';'1980' ];
plot(perc_unemploy_data,cpi_data,'o');
% In this next text command two text properties were made
% use of so that the plot would look better. You will
%learn how to manipulate these in Chapter 7.
text(perc_unemploy_data,cpi_data,year_strings,...
'fontsize',10,...
'verticalalignment','bottom');
axis([0 10 0 14]);
xlabel('Percent Unemployment');
ylabel('Percent change in CPI');
close all
clc
% Source of data: Economic Report of the President, 1986.
cpi_data = [1.7 2.9 2.9 4.2 5.4 5.9 4.3 3.3 6.2 ...
11.0 9.1 5.8 6.5 7.7 11.3 13.5];
perc_unemploy_data = [4.5 3.8 3.8 3.6 3.5 4.9 5.9 ...
5.6 4.9 5.6 8.5 7.7 7.0 6.0 5.8 7.0];
year_strings = ['1965';'1966';'1967';'1968';'1969';...
'1970';'1971';'1972';'1973';'1974';...
'1975';'1976';'1977';'1978';'1979';'1980' ];
plot(perc_unemploy_data,cpi_data,'o');
% In this next text command two text properties were made
% use of so that the plot would look better. You will
%learn how to manipulate these in Chapter 7.
text(perc_unemploy_data,cpi_data,year_strings,...
'fontsize',10,...
'verticalalignment','bottom');
axis([0 10 0 14]);
xlabel('Percent Unemployment');
ylabel('Percent change in CPI');
نتیجه :
منبع کدها :
کتاب Graphics and GUIs with MATLAB - صفحه 68 از فایل pdf کتاب
دسته بندی
انواع رسم شکل در متلب
نظرات 0 0 0