concen.m
来自「matlab宝典,电子工业出版社,包含该书的源码2-4章」· M 代码 · 共 19 行
M
19 行
function [r1, r2] = concen(toxtest);
% Create two vectors. r1 contains the ratio of mercury to lead
% at each observation. r2 contains the ratio of lead to chromium.
r1 = [toxtest.mercury] ./ [toxtest.lead];
r2 = [toxtest.lead] ./ [toxtest.chromium];
% Plot the concentrations of lead, mercury, and chromium
% on the same plot, using different colors for each.
lead = [toxtest.lead];
mercury = [toxtest.mercury];
chromium = [toxtest.chromium];
plot(lead, 'r','LineWidth',1.5); hold on
plot(mercury, 'b','LineWidth',1.5)
plot(chromium, 'y','LineWidth',1.5); hold off
legend('lead','mercury','chromium')
title('The ratio of mix')
grid
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?