e421.m
来自「学习Matlab循环语句的好例子」· M 代码 · 共 33 行
M
33 行
% 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 + =
减小字号Ctrl + -
显示快捷键?