⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 e421.m

📁 学习Matlab循环语句的好例子
💻 M
字号:
% Script file: E421.m

% Purpose:
% Write a program to determine the idistance d at which
% to attach the cable to the pole to minimize the tension on the cable.
% in d=1:1:7,also plot the tension on the cable as a function of d.

% Record of revisions
%   Date            Programmer         Description of change
% ==========    =================    ==========================
% 13/06/08          ZMW                Original code

% Define Variables
% T  ------the tension on the cable
% d  ------ the distance along the pole at which the cable is attached
% ii  --------the index

% Constants
lc=8;
lp=8;
W=200;
ii=1;
for d=1:7
    T(ii)=W*lc*lp./(d*sqrt(lp^2-d.^2));
    ii=ii+1;
end
d=1:7;
plot(d,T,'r*');
title('\bfd vs T');
xlabel('\bf\itd \rm\bf(feet)');
ylabel('\bf\itT \rm\bf(bound)');
grid on 
[minT,d]=min(T)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -