Você está na página 1de 6

# %MEMBRANE Generate MathWorks's logos.

%
% L = MEMBRANE(k), for k <= 12, is the k-th eigenfunction of

-5
% the L-shaped membrane. The first three eigenfunctions have
% been shown on the covers of various MathWorks publications.
Scope

%
% MEMBRANE(k), with no output parameters, plots the k-th eigenfunction. 2
% Out2
% MEMBRANE, with no input or output parameters, plots MEMBRANE(1).
%

0
% L = MEMBRANE(k,m,n,np) also sets some mesh and accuracy parameters:
%
% k = index of eigenfunction, default k = 1.
% m = number of points on 1/3 of boundary. The size of
% the output is 2*m+1-by-2*m+1. The default m = 15.
% n = number of terms in sum, default n = min(m,9).
% np = number of terms in partial sum, default np = min(n,2).
% With np = n, the eigenfunction is nearly zero on the boundary.
%
%
5
With np < n, like np = 2, the boundary is not tied down.

% Out-of-date reference:
% Fox, Henrici & Moler, SIAM J. Numer. Anal. 4, 1967, pp. 89-102.
% Cleve Moler 4-21-85, 7-21-87, 6-30-91, 6-17-92;
% Copyright (c) 1984-94 by The MathWorks, Inc.

10
Smart Industry System Design with MATLAB and Simulink
if nargin < 1, k = 1; end
if nargin < 2, m = 15; end
if nargin < 2 & isstudent, m = 10; end
if nargin < 3, n = min(m,9); end
if nargin < 4, np = min(n,2); end

## Answers to the Top 3 Engineering Questions if

end
k > 12
error(Only the first 12 membrane eigenfunctions are available.)

## lambda = [9.6397238445, 15.19725192, 2*pi^2, 29.5214811, 31.9126360, ...

41.4745099, 44.948488, 5*pi^2, 5*pi^2, 56.709610, 65.376535, 71.057755];
lambda = lambda(k);
sym = [1 2 3 2 1 1 2 3 3 1 2 1];
sym = sym(k);

## % Part of the boundary in polar coordinates

theta = (1:3*m)/m * pi/4;
r = [ones(m,1)./cos(theta(1:m)); ones(2*m,1)./sin(theta(m+1:3*m))];

## % if sym = 1, alfa = [1 5 7 11 13 17 19 ... ] * 2/3, (odd, not divisible by 3)

% if sym = 2, alfa = [2 4 8 10 14 16 20 ... ] * 2/3, (even, not divisible by
3)
% if sym = 3, alfa = [3 6 9 12 15 18 21 ... ] * 2/3, (multiples of 3)
alfa = sym;
del = sym + 3*(sym == 1);
for j = 2:n,
alfa(j) = alfa(j-1) + del;
del = 6-del;
end;
alfa = alfa * 2/3;
if sym ~= 3
alf1 = (alfa(1):1:max(alfa));
alf2 = (alfa(2):1:max(alfa));
k1 = 1:4:length(alf1);
k2 = 1:4:length(alf2);
else
alf1 = (alfa(1):1:max(alfa));
alf2 = [];
k1 = 1:2:length(alf1);
k2 = [];
end

## % Build up the matrix of fundamental solutions evaluated on the boundary.

t = sqrt(lambda)*r;
b1 = besselj(alf1,t);
b2 = besselj(alf2,t);
A = [b1(:,k1) b2(:,k2)];
[ignore,k] = sort([k1 k2]);
A = A(:,k);
A = A.*sin(theta*alfa);

## % The desired coefficients are the null vector.

% (lambda was chosen so that the matrix is rank deficient).
[Q,R,E] = qr(A);
j = 1:n-1;
c = -R(j,j)\R(j,n);
c(n) = 1;
c = E*c(:);
if c(1) < 0, c = -c; end
% The residual should be small.
% res = norm(A*c,inf)/norm(abs(A)*abs(c),inf)

## % Now evaluate the eigenfunction on a rectangular mesh in the interior.

mm = 2*m+1;
x = ones(m+1,1)*(-m:m)/m;
y = (m:-1:0)/m*ones(1,mm);
r = sqrt(x.*x + y.*y);
theta = atan2(y,x);
theta(m+1,m+1) = 0;
S = zeros(m+1,mm);
r = sqrt(lambda)*r;
for j = 1:np
S = S + c(j) * besselj(alfa(j),r) .* sin(alfa(j)*theta);
end

L = zeros(mm,mm);
L(1:m+1,:) = triu(S);
if sym == 1, L = L + L - diag(diag(L)); end
if sym == 2, L = L - L; end
if sym == 3, L = L + L - diag(diag(L)); end
L = rot90(L/max(max(abs(L))),-1);

if nargout == 0
x = -1:1/m:1;
surf(x,x,L)
colormap(cool)
else
Lout = L;
end
%MEMBRANE Generate MathWorks's logos.
%
% L = MEMBRANE(k), for k <= 12, is the k-th eigenfunction of

-5
% the L-shaped membrane. The first three eigenfunctions have
% been shown on the covers of various MathWorks publications.
Scope

%
% MEMBRANE(k), with no output parameters, plots the k-th eigenfunction. 2
% Out2
% MEMBRANE, with no input or output parameters, plots MEMBRANE(1).
%

0
% L = MEMBRANE(k,m,n,np) also sets some mesh and accuracy parameters:
%
% k = index of eigenfunction, default k = 1.
% m = number of points on 1/3 of boundary. The size of
% the output is 2*m+1-by-2*m+1. The default m = 15.
% n = number of terms in sum, default n = min(m,9).
% np = number of terms in partial sum, default np = min(n,2).
% With np = n, the eigenfunction is nearly zero on the boundary.
%
%
5
With np < n, like np = 2, the boundary is not tied down.

How Smart Industry Is Putting Data Front and Center % Out-of-date reference:
% Fox, Henrici & Moler, SIAM J. Numer. Anal. 4, 1967, pp. 89-102.
% Cleve Moler 4-21-85, 7-21-87, 6-30-91, 6-17-92;
% Copyright (c) 1984-94 by The MathWorks, Inc.

10
Philipp H. F. Wallner, Industry Manager, MathWorks if
if
if
nargin < 1, k = 1; end
nargin < 2, m = 15; end
nargin < 2 & isstudent, m = 10; end

## Seth DeLand, Product Manager, MathWorks

if nargin < 3, n = min(m,9); end
if nargin < 4, np = min(n,2); end
if k > 12
error(Only the first 12 membrane eigenfunctions are available.)
end
The industrial world is changing with the emergence of smart industry. Todays
lambda = [9.6397238445, 15.19725192, 2*pi^2, 29.5214811, 31.9126360, ...

## production machines and handling equipment have become highly lambda

integrated
41.4745099, 44.948488, 5*pi^2, 5*pi^2, 56.709610, 65.376535, 71.057755];
= lambda(k);
sym = [1 2 3 2 1 1 2 3 3 1 2 1];
mechatronic systems with a significant portion of embedded software.
sym =This
sym(k);fact

## requires several domains software engineering, IT, mechanical engineering, and

% Part of the boundary in polar coordinates
theta = (1:3*m)/m * pi/4;
r = [ones(m,1)./cos(theta(1:m)); ones(2*m,1)./sin(theta(m+1:3*m))];
electrical engineering to work together and evolve the way they design, test, and
% if sym = 1, alfa = [1 5 7 11 13 17 19 ... ] * 2/3, (odd, not divisible by 3)

verify machine software. Only then can they reach the expected level of function-
% if sym = 2, alfa = [2 4 8 10 14 16 20 ... ] * 2/3, (even, not divisible by
3)
% if sym = 3, alfa = [3 6 9 12 15 18 21 ... ] * 2/3, (multiples of 3)
ality and quality. alfa = sym;
del = sym + 3*(sym == 1);
for j = 2:n,
alfa(j) = alfa(j-1) + del;
Data Proliferation Extracting Valuable Insight end;
del = 6-del;

## alfa = alfa * 2/3;

if sym ~= 3

A major driver of smart industry is the growing amount of data. Vision sensors, alf1 = (alfa(1):1:max(alfa));
alf2 = (alfa(2):1:max(alfa));
k1 = 1:4:length(alf1);
electric and hydraulic drives, even production machines and power plants all col- else
k2 = 1:4:length(alf2);

lect measured data during operation. This data contains information that can be alf1 = (alfa(1):1:max(alfa));
alf2 = [];
k1 = 1:2:length(alf1);
transformed into business value using predictive models and algorithms. For exam- end
k2 = [];

## ple, machine learning techniques may be used to train a model to historical

% Build up the sensor
matrix of fundamental solutions evaluated on the boundary.
t = sqrt(lambda)*r;
data, so that the model can be used to predict future equipment failures and pre-
b1 = besselj(alf1,t);
b2 = besselj(alf2,t);

## vent production downtimes. A = [b1(:,k1) b2(:,k2)];

[ignore,k] = sort([k1 k2]);
A = A(:,k);
A = A.*sin(theta*alfa);

Deploying Analytics to Embedded Systems % The desired coefficients are the null vector.
% (lambda was chosen so that the matrix is rank deficient).
[Q,R,E] = qr(A);
j = 1:n-1;
As smart industry evolves, software components provide a significant part of the added value of machines and production
c = -R(j,j)\R(j,n);
c(n) = 1;

plants. Embedded software running on PLCs, industrial PCs, or FPGAs use closed-loop control functionality that ensures product
c = E*c(:);
if c(1) < 0, c = -c; end
% The residual should be small.
quality, and predictive maintenance algorithms for increased uptime without service intervention. Furthermore, embedded soft-
% res = norm(A*c,inf)/norm(abs(A)*abs(c),inf)

ware is used for supervisory logic for state machines handling and automatic generation of optimized movement trajectories
% Now evaluate the eigenfunction on a rectangular mesh in the interior.
mm = 2*m+1;
x = ones(m+1,1)*(-m:m)/m;
even for safety-critical systems. y = (m:-1:0)/m*ones(1,mm);
r = sqrt(x.*x + y.*y);
theta = atan2(y,x);
theta(m+1,m+1) = 0;
The Use of Model-Based Design S = zeros(m+1,mm);
r = sqrt(lambda)*r;
for j = 1:np
S = S + c(j) * besselj(alfa(j),r) .* sin(alfa(j)*theta);
To become market leaders, equipment manufacturers need to develop skills and expertise in new software design approaches
end

L = zeros(mm,mm);
and technologies to realize the efficiency, cost, and, therefore, competitive advantages that smart industry promises. Software
L(1:m+1,:) = triu(S);
if sym == 1, L = L + L - diag(diag(L)); end
design productivity and system reliability increase with Model-Basedifif Design
sym == 3, L tools
= L + L like
sym == 2, L = L - L; end
MATLAB
- diag(diag(L)); end and Simulink. These tools
L = rot90(L/max(max(abs(L))),-1);
facilitate modular software development of automation components,ifhardware-independent
nargout == 0
testing, and automatic code genera-
tion that can implement algorithms on embedded hardware platformsxsurf(x,x,L)
at the touch of a button.
= -1:1/m:1;

colormap(cool)
else

## The Race to Smart Industry Realization end

Lout = L;

Smart industry depends on the growing complexity of software and an ever-increasing amount of machine data. In the long
term, the evolving trend will challenge engineers to become proficient in using new software design methods and data analytics
tools in order to embrace this complexity.

2
%MEMBRANE Generate MathWorks's logos.
%
% L = MEMBRANE(k), for k <= 12, is the k-th eigenfunction of

-5
% the L-shaped membrane. The first three eigenfunctions have
% been shown on the covers of various MathWorks publications.
Scope

%
% MEMBRANE(k), with no output parameters, plots the k-th eigenfunction. 2
% Out2
% MEMBRANE, with no input or output parameters, plots MEMBRANE(1).
%

0
% L = MEMBRANE(k,m,n,np) also sets some mesh and accuracy parameters:
%
% k = index of eigenfunction, default k = 1.
% m = number of points on 1/3 of boundary. The size of
% the output is 2*m+1-by-2*m+1. The default m = 15.
% n = number of terms in sum, default n = min(m,9).
% np = number of terms in partial sum, default np = min(n,2).
% With np = n, the eigenfunction is nearly zero on the boundary.
%
%
5
With np < n, like np = 2, the boundary is not tied down.

## Top 3 Questions from Engineers % Out-of-date reference:

% Fox, Henrici & Moler, SIAM J. Numer. Anal. 4, 1967, pp. 89-102.
% Cleve Moler 4-21-85, 7-21-87, 6-30-91, 6-17-92;
% Copyright (c) 1984-94 by The MathWorks, Inc.

10
1. How can you use machine data to improve production performance or predict failure?
if nargin < 1, k = 1; end
if nargin < 2, m = 15; end
if nargin < 2 & isstudent, m = 10; end
if nargin < 3, n = min(m,9); end
if nargin < 4, np = min(n,2); end

MATLAB allows you to analyze machine and production data, identify patterns, and optimize machine parameters
if k > 12
error(Only the first 12 membrane eigenfunctions are available.)
end

and service intervals. lambda = [9.6397238445, 15.19725192, 2*pi^2, 29.5214811, 31.9126360, ...
41.4745099, 44.948488, 5*pi^2, 5*pi^2, 56.709610, 65.376535, 71.057755];
lambda = lambda(k);

sym = sym(k);

## Offline Data Analysis is used on recorded data Key Products

% Part of the boundary in polar coordinates
theta = (1:3*m)/m * pi/4;

## stored in files, databases, or in the cloud. r = [ones(m,1)./cos(theta(1:m)); ones(2*m,1)./sin(theta(m+1:3*m))];

MATLAB
% if sym = 1, alfa = [1 5 7 11 13 17 19 ... ] * 2/3, (odd, not divisible by 3)
% if sym = 2, alfa = [2 4 8 10 14 16 20 ... ] * 2/3, (even, not divisible by
Workflows: OPC
3)
Toolbox
% if sym = 3, alfa = [3 6 9 12 15 18 21 ... ] * 2/3, (multiples of 3)

Data Acquisition
+ 3*(sym == 1); Toolbox
alfa = sym;
Import data into MATLAB del = sym
for j = 2:n,
alfa(j) = alfa(j-1) + del;
Analyze data end;
del = 6-del;

## User Story: Newport Corporation Reduces Data Acquisition and

alfa = alfa * 2/3;
Use results to optimize machine throughput if sym ~= 3
Analysis Time by Hundreds of Hours
alf1 = (alfa(1):1:max(alfa));
or service intervals alf2 = (alfa(2):1:max(alfa));
k1 = 1:4:length(alf1);

## Technical Article: 5 Types of Data and How to Analyze Them with

k2 = 1:4:length(alf2);
else
Online Data Analysis is used to continuously analyze alf1 = (alfa(1):1:max(alfa));
MATLAB alf2 = [];
machine behavior k1 = 1:2:length(alf1);
k2 = [];
end

## Workflows: % Build up the matrix of fundamental solutions evaluated on the boundary.

t = sqrt(lambda)*r;
b1 = besselj(alf1,t);
Read data via OPC UA and other standards b2 = besselj(alf2,t);
A = [b1(:,k1) b2(:,k2)];
[ignore,k] = sort([k1 k2]);
Deploy real-time code (C/C++, IEC 61131-3) A = A(:,k);
A = A.*sin(theta*alfa);
on PLC or embedded controller % The desired coefficients are the null vector.
% (lambda was chosen so that the matrix is rank deficient).
[Q,R,E] = qr(A);
MATLAB helps you analyze measured signals Key Products
j = 1:n-1;
c = -R(j,j)\R(j,n);
(e.g., vibration data) by: c(n) = 1;
MATLAB
c = E*c(:);
if c(1) < 0, c = -c; end
Transferring into frequency domain Signal Processing Toolbox
% The residual should be small.
% res = norm(A*c,inf)/norm(abs(A)*abs(c),inf)

Applying filters % Now evaluate the eigenfunction on a rectangular mesh in the interior.
mm = 2*m+1;
x = ones(m+1,1)*(-m:m)/m;
User Story: BuildingIQ Develops Proactive Algorithms for HVAC
y = (m:-1:0)/m*ones(1,mm);
Did You Know? Ready-made functions save time r = sqrt(x.*x + y.*y);

## compared to manual programming (such as in Energy Optimization in Large-Scale Buildings

theta = atan2(y,x);
theta(m+1,m+1) = 0;
S = zeros(m+1,mm);
Visual Studio). Webinar: Signal Processing and Machine Learning Techniques
r = sqrt(lambda)*r;
for j = 1:np
S = S + c(j) * besselj(alfa(j),r) .* sin(alfa(j)*theta);
for Sensor Data Analytics
end

L = zeros(mm,mm);
L(1:m+1,:) = triu(S);
if sym == 1, L = L + L - diag(diag(L)); end
Engineers working with large amounts of business Key Products
if sym == 2, L = L - L; end
if sym == 3, L = L + L - diag(diag(L)); end
and engineering data use machine learning to find L = rot90(L/max(max(abs(L))),-1);

## patterns and build models to predict future outcomes MATLAB

if nargout == 0
x = -1:1/m:1;

based on historical data (such as for Statistics and Machine Learning Toolbox
surf(x,x,L)
colormap(cool)

## predictive maintenance). Neural

else
Network
Lout = L; Toolbox
end

## User Story: Mondi Implements Statistics-Based Health Monitoring

and Predictive Maintenance for Manufacturing Processes with
Machine Learning
Technical Article: Data-Driven Insights with MATLAB Analytics:
An Energy Load Forecasting Case Study
Mondi Implements Statistics-Based Health Monitoring and Predictive Overview: Predictive Maintenance
Maintenance for Manufacturing Processes with Machine Learning

3
%MEMBRANE Generate MathWorks's logos.
%
% L = MEMBRANE(k), for k <= 12, is the k-th eigenfunction of

-5
% the L-shaped membrane. The first three eigenfunctions have
% been shown on the covers of various MathWorks publications.
Scope

%
% MEMBRANE(k), with no output parameters, plots the k-th eigenfunction. 2
% Out2
% MEMBRANE, with no input or output parameters, plots MEMBRANE(1).
%

0
% L = MEMBRANE(k,m,n,np) also sets some mesh and accuracy parameters:
%
% k = index of eigenfunction, default k = 1.
% m = number of points on 1/3 of boundary. The size of
% the output is 2*m+1-by-2*m+1. The default m = 15.
% n = number of terms in sum, default n = min(m,9).
% np = number of terms in partial sum, default np = min(n,2).
% With np = n, the eigenfunction is nearly zero on the boundary.
%
%
5
With np < n, like np = 2, the boundary is not tied down.

2. How can you develop optimized closed-loop controllers for increasingly % Out-of-date reference:
% Fox, Henrici & Moler, SIAM J. Numer. Anal. 4, 1967, pp. 89-102.

complex systems?
% Cleve Moler 4-21-85, 7-21-87, 6-30-91, 6-17-92;
% Copyright (c) 1984-94 by The MathWorks, Inc.

## 10 if nargin < 1, k = 1; end

if nargin < 2, m = 15; end

Virtual commissioning based on Model-Based Design helps optimize controls structures and parameters during simulation.
if nargin < 2 & isstudent, m = 10; end
if nargin < 3, n = min(m,9); end
if nargin < 4, np = min(n,2); end

During simulation it is faster, safer and less expensive to design and test your controller and optimize parameters.
if k > 12
error(Only the first 12 membrane eigenfunctions are available.)
end

## lambda = [9.6397238445, 15.19725192, 2*pi^2, 29.5214811, 31.9126360, ...

41.4745099, 44.948488, 5*pi^2, 5*pi^2, 56.709610, 65.376535, 71.057755];
lambda = lambda(k);

sym = sym(k);

## MATLAB and Simulink products for control system Key Products

% Part of the boundary in polar coordinates
theta = (1:3*m)/m * pi/4;

## design support: r = [ones(m,1)./cos(theta(1:m)); ones(2*m,1)./sin(theta(m+1:3*m))];

% if sym = 1, alfa = [1 5 7 11 13 17 19 ... ] * 2/3, (odd, not divisible by 3)

Plant modeling
% if sym = 2, alfa = [2 4 8 10 14 16 20 ... ] * 2/3, (even, not divisible by
Stateflow
3)
% if sym = 3, alfa = [3 6 9 12 15 18 21 ... ] * 2/3, (multiples of 3)

alfa = sym;
Control
del = sym + 3*(sym == 1);Design
for j = 2:n,

## Automated testing and reporting Control System Toolbox

alfa(j) = alfa(j-1) + del;
del = 6-del;

end;

if sym ~= 3
* 2/3;

## (C/C++, IEC 61131-3, HDL) User Story:

alf1 = (alfa(1):1:max(alfa));
alf2Metso Develops Controller for Energy-Saving Digital
= (alfa(2):1:max(alfa));
k1 = 1:4:length(alf1);

## Did You Know? Automatic code generation generates Hydraulic

else System for Papermaking Equipment Using
k2 = 1:4:length(alf2);

## highly efficient code for your controller and helps

alf1 = (alfa(1):1:max(alfa));
Model-Based
alf2 = Design
[];

## avoid coding errors.

k1 = 1:2:length(alf1);
k2 = [];

Overview:
end
Control Design Software
% Build up the matrix of fundamental solutions evaluated on the boundary.
t = sqrt(lambda)*r;

Control system design starts with a plant model for Key Products
b1 = besselj(alf1,t);
b2 = besselj(alf2,t);

## system simulation. MATLAB and Simulink products

A = [b1(:,k1) b2(:,k2)];

## Simscape products for physical modeling

[ignore,k] = sort([k1 k2]);
A = A(:,k);
support a variety of plant modeling approaches: A = A.*sin(theta*alfa);
System Identification
coefficients are Toolbox
Physical modeling using blocks that represent
% The desired the null vector.
% (lambda was chosen so that the matrix is rank deficient).
[Q,R,E] = qr(A);
mechanical, electrical, magnetic, hydraulic, pneu- j = 1:n-1;

matic, and thermal components Webinar: Simscape: Reach for the Run Button
c = -R(j,j)\R(j,n);
c(n) = 1;
c = E*c(:);
if c(1) < 0, c = -c; end
System identification based on measured data User Story: manroland Develops High-Precision Commercial Printing
% The residual should be small.
% res = norm(A*c,inf)/norm(abs(A)*abs(c),inf)
Press Controller
% Now evaluate the eigenfunction on a rectangular mesh in the interior.
Did You Know? You can design your system without mm = 2*m+1;

## Overview: Creating Accurate Plant Models

x = ones(m+1,1)*(-m:m)/m;
the need to wait for hardware. y = (m:-1:0)/m*ones(1,mm);
r = sqrt(x.*x + y.*y);
theta = atan2(y,x);
Technical Article: =Modeling
theta(m+1,m+1) 0;
S = zeros(m+1,mm);
Complex Mechanical Structures
with SimMechanics
r = sqrt(lambda)*r;
for j = 1:np
S = S + c(j) * besselj(alfa(j),r) .* sin(alfa(j)*theta);
end

## Perform early verification and testing on your system Key Products

L = zeros(mm,mm);
L(1:m+1,:) = triu(S);
model through: if sym == 1, L = L + L - diag(diag(L)); end

if sym == 3, Design
L = L + L Verifier
if sym == 2, L = L - L; end
- diag(diag(L)); end
Desktop simulation
L = rot90(L/max(max(abs(L))),-1);
if nargout == 0
x = -1:1/m:1;
surf(x,x,L)
colormap(cool)
Automated test scenarios Polyspace
else
Lout = L;
Bug Finder and Polyspace Code Prover
end
Real-Time

Did You Know? Find design errors before building User Story: Baker Hughes Improves Precision of Oil and
hardware and creating production software.
Gas Drilling Equipment
Video: Early Verification for Control Systems
Overview: Verification, Validation, and Test

## Baker Hughes Improves Precision of Oil and Gas Drilling Equipment

4
%MEMBRANE Generate MathWorks's logos.
%
% L = MEMBRANE(k), for k <= 12, is the k-th eigenfunction of

-5
% the L-shaped membrane. The first three eigenfunctions have
% been shown on the covers of various MathWorks publications.
Scope

%
% MEMBRANE(k), with no output parameters, plots the k-th eigenfunction. 2
% Out2
% MEMBRANE, with no input or output parameters, plots MEMBRANE(1).
%

0
% L = MEMBRANE(k,m,n,np) also sets some mesh and accuracy parameters:
%
% k = index of eigenfunction, default k = 1.
% m = number of points on 1/3 of boundary. The size of
% the output is 2*m+1-by-2*m+1. The default m = 15.
% n = number of terms in sum, default n = min(m,9).
% np = number of terms in partial sum, default np = min(n,2).
% With np = n, the eigenfunction is nearly zero on the boundary.
%
%
5
With np < n, like np = 2, the boundary is not tied down.

3. How can you implement controls algorithms and state machines on a % Out-of-date reference:
% Fox, Henrici & Moler, SIAM J. Numer. Anal. 4, 1967, pp. 89-102.

## PLC or industrial PC?

% Cleve Moler 4-21-85, 7-21-87, 6-30-91, 6-17-92;
% Copyright (c) 1984-94 by The MathWorks, Inc.

## 10 if nargin < 1, k = 1; end

if nargin < 2, m = 15; end

Automatic code generation allows you to deploy algorithms that have been tested in simulation on common PLC or industrial PC
if nargin < 2 & isstudent, m = 10; end
if nargin < 3, n = min(m,9); end
if nargin < 4, np = min(n,2); end

platforms using either IEC 61131-3 (structured text or ladder diagram) or C/C++.
if k > 12
error(Only the first 12 membrane eigenfunctions are available.)
end

## lambda = [9.6397238445, 15.19725192, 2*pi^2, 29.5214811, 31.9126360, ...

41.4745099, 44.948488, 5*pi^2, 5*pi^2, 56.709610, 65.376535, 71.057755];
lambda = lambda(k);

sym = sym(k);

## Automatic code generation converts tested models and Key Products

% Part of the boundary in polar coordinates
theta = (1:3*m)/m * pi/4;

## code (C/C++ and IEC 61131-3). Simulink

% if sym = 1,PLC Coder
alfa = [1 5 7 11 13 17 19 ... ] * 2/3, (odd, not divisible by 3)
% if sym = 2, alfa = [2 4 8 10 14 16 20 ... ] * 2/3, (even, not divisible by
MATLAB
3)
Coder
% if sym = 3, alfa = [3 6 9 12 15 18 21 ... ] * 2/3, (multiples of 3)

alfa = sym;
del = sym + 3*(sym == 1);

## Did You Know? This workflow is much faster than hand

for j = 2:n,
Embedded Coder
alfa(j) = alfa(j-1) + del;

## coding enabling developers of industrial controls to

del = 6-del;
end;

User Story:
if sym ENGEL Speeds Development of Injection Molding
alfa = alfa * 2/3;
increase productivity 200-300%. Its also less error ~= 3
alf1 = (alfa(1):1:max(alfa));
prone. Machine k1Controllers
alf2 = (alfa(2):1:max(alfa));
= 1:4:length(alf1);
k2 = 1:4:length(alf2);

Webinar:
else
Model-Based
alf1 Design for Automation Systems
= (alfa(1):1:max(alfa));
alf2 = [];
k1 = 1:2:length(alf1);
k2 = [];
end
IEC 61508 is the primary safety standard for industrial Key Products
% Build up the matrix of fundamental solutions evaluated on the boundary.

## controls. TV SD has certified the following products:

t = sqrt(lambda)*r;

## IEC Certification Kit

b1 = besselj(alf1,t);
b2 = besselj(alf2,t);

Embedded Coder
A = [b1(:,k1) b2(:,k2)];
Polyspace Bug Finder and Polyspace Code Prover
[ignore,k] = sort([k1 k2]);
A = A(:,k);

## Polyspace code verifiers Embedded Coder

A = A.*sin(theta*alfa);

## % The desired coefficients are the null vector.

% (lambda wasPLC Coder
chosen
[Q,R,E] = qr(A);
so that the matrix is rank deficient).

j = 1:n-1;
c = -R(j,j)\R(j,n);
Did You Know? TV SD certifications are based on Technical
c = Article:
c(n) = 1;
E*c(:); Improving Software Quality with
application-specific verification and validation work- if c(1) < 0, c = -c; end
Static Code Analysis
% The residual should be small.

flows that are provided in the IEC Certification Kit. % res = norm(A*c,inf)/norm(abs(A)*abs(c),inf)

## Link: Supported Standards and Products

% Now evaluate the eigenfunction on a rectangular mesh in the interior.
mm = 2*m+1;
x = ones(m+1,1)*(-m:m)/m;
y = (m:-1:0)/m*ones(1,mm);
r = sqrt(x.*x + y.*y);

## Automatic code generation is available for most Supported PLC Platforms

theta = atan2(y,x);
theta(m+1,m+1) = 0;

## common PLC and industrial PC platforms. MathWorks

S = zeros(m+1,mm);

## Support for Third-Party IDEs in Simulink PLC Coder

r = sqrt(lambda)*r;
for j = 1:np
works with hardware partners to ensure compatibility S = S + c(j) * besselj(alfa(j),r) .* sin(alfa(j)*theta);

with their integrated development environments (IDEs). Hardware Support for PLC Code Generation
end

L = zeros(mm,mm);
(C/C++
L(1:m+1,:) =and IEC 61131-3)
triu(S);

PLC partners:
if sym == 1, L = L + L - diag(diag(L)); end
if sym == 2, L = L - L; end
if sym == 3, L = L + L - diag(diag(L)); end

## 3S CODESYS User Story: AVL Develops Dynamic Controller for Engine

L = rot90(L/max(max(abs(L))),-1);

if nargout == 0

## B&R Automation Studio

x = -1:1/m:1;
surf(x,x,L)
colormap(cool)

Bachmann M-Target
else
Lout = L;
end

Beckhoff TwinCAT
Mitsubishi CW Workbench
Omron Sysmac Studio
Phoenix Contact PC WORX
Rexroth IndraWorks
Rockwell Automation RSLogix
and Studio 5000
Siemens STEP 7, WinAC and TIA Portal AVL Develops Dynamic Controller for Engine Conditioning System
Using Embedded Code Generation for PLCs

5
%MEMBRANE Generate MathWorks's logos.
%
% L = MEMBRANE(k), for k <= 12, is the k-th eigenfunction of

-5
% the L-shaped membrane. The first three eigenfunctions have
% been shown on the covers of various MathWorks publications.
Scope

%
% MEMBRANE(k), with no output parameters, plots the k-th eigenfunction. 2
% Out2
% MEMBRANE, with no input or output parameters, plots MEMBRANE(1).
%

0
% L = MEMBRANE(k,m,n,np) also sets some mesh and accuracy parameters:
%
% k = index of eigenfunction, default k = 1.
% m = number of points on 1/3 of boundary. The size of
% the output is 2*m+1-by-2*m+1. The default m = 15.
% n = number of terms in sum, default n = min(m,9).
% np = number of terms in partial sum, default np = min(n,2).
% With np = n, the eigenfunction is nearly zero on the boundary.
%
%
5
With np < n, like np = 2, the boundary is not tied down.

## Voice of the User % Out-of-date reference:

% Fox, Henrici & Moler, SIAM J. Numer. Anal. 4, 1967, pp. 89-102.
% Cleve Moler 4-21-85, 7-21-87, 6-30-91, 6-17-92;
% Copyright (c) 1984-94 by The MathWorks, Inc.

## if nargin < 1, k = 1; end 10

if nargin < 2, m = 15; end
if nargin < 2 & isstudent, m = 10; end
On previous projects, we have written structured text by
With Model-Based Design, we see development time reduc- if
if
nargin < 3, n = min(m,9); end
nargin < 4, np = min(n,2); end
if hand for the feedforward control, but it would be too compli-
k > 12
tion, cost savings, and improved time-to-market. Automatic code error(Only the first 12 membrane eigenfunctions are available.)
end
cated to implement feedback control of the Bionic Handling
generation saves a great deal of time. In addition, we can lambda = [9.6397238445, 15.19725192, 2*pi^2, 29.5214811, 31.9126360, ...
Assistant on a PLC using this manual approachwe simply
41.4745099, 44.948488, 5*pi^2, 5*pi^2, 56.709610, 65.376535, 71.057755];
simply change the model to update our design, and we know it lambda = lambda(k);
sym = [1 2 3 2 1 1 2 3 3 1 2 1];
would not have done it. Simulink PLC Coder enabled us to
will be implemented as required. Our design iterations, from sym = sym(k);

## generate the structured text automatically in minutes.

% Part of the boundary in polar coordinates
making changes to hardware testing, are completed in theta = (1:3*m)/m * pi/4;
r = [ones(m,1)./cos(theta(1:m)); ones(2*m,1)./sin(theta(m+1:3*m))];
five minutes. D.R
% if sym = 1, ralfa diger N
= [1 5 7 11eumann ,F
13 17 19 ...esto
] * 2/3, (odd, not divisible by 3)
% if sym = 2, alfa = [2 4 8 10 14 16 20 ... ] * 2/3, (even, not divisible by
3)
Arend -Jan Beltman, Centre for Concepts in Mechatronics % if sym = 3, alfa = [3 6 9 12 15 18 21 ... ] * 2/3, (multiples of 3)
alfa = sym;
del = sym + 3*(sym == 1);
for j = 2:n,
alfa(j) = alfa(j-1) + del;
del = 6-del;
end;
alfa = alfa * 2/3;
As a manufacturing company we dont have data scientists with machine
if sym ~= 3
alf1 = (alfa(1):1:max(alfa));

learning expertise, but MathWorks provided the tools and technical know-
alf2 = (alfa(2):1:max(alfa));
k1 = 1:4:length(alf1);
k2 = 1:4:length(alf2);
how that enabled us to develop a production preventative maintenance
else
alf1 = (alfa(1):1:max(alfa));

## system in a matter of months.

alf2 = [];
k1 = 1:2:length(alf1);
k2 = [];
end
Dr. Michael Kohlert, Mondi
% Build up the matrix of fundamental solutions evaluated on the boundary.
t = sqrt(lambda)*r;
b1 = besselj(alf1,t);
b2 = besselj(alf2,t);
A = [b1(:,k1) b2(:,k2)];
[ignore,k] = sort([k1 k2]);
A = A(:,k);
As a process engineer I had no experience with neural A = A.*sin(theta*alfa);

networks or machine learning. I worked through the MATLAB % The desired coefficients are the null vector.
% (lambda was chosen so that the matrix is rank deficient).

## Our shopfloor management system AMS ZPoint-CI collects a

[Q,R,E] = qr(A);
examples to find the best machine learning functions for gen- j = 1:n-1;
c = -R(j,j)\R(j,n);
erating virtual metrology. I couldnt have done this in C or c(n) = 1;
c = E*c(:);
huge amount of machine, process, and product data 24 hours
a day. By analyzing this data immediately in MATLAB and
if c(1) < 0, c = -c; end
Pythonit wouldve taken too long to find, validate, and inte- % The residual should be small.
% res = norm(A*c,inf)/norm(abs(A)*abs(c),inf)
grate the right packages. AMS Analysis-CI we have achieved a tenfold increase in pre-
% Now evaluate the eigenfunction on a rectangular mesh in the interior.

mm = 2*m+1;

## Emil Schmitt-Weaver, ASML

x = ones(m+1,1)*(-m:m)/m;
y = (m:-1:0)/m*ones(1,mm);
increase in production output.
r = sqrt(x.*x + y.*y);
theta = atan2(y,x);
theta(m+1,m+1) = 0;
A
S = zeros(m+1,mm);
lexander
r = sqrt(lambda)*r; M eisinger ,S tiwa
for j = 1:np
S = S + c(j) * besselj(alfa(j),r) .* sin(alfa(j)*theta);
end

L = zeros(mm,mm);
L(1:m+1,:) = triu(S);
if sym == 1, L = L + L - diag(diag(L)); end
if sym == 2, L = L - L; end
if sym == 3, L = L + L - diag(diag(L)); end
L = rot90(L/max(max(abs(L))),-1);

## Additional Resources if nargout == 0

x = -1:1/m:1;
surf(x,x,L)
colormap(cool)

With MATLAB and Simulink, engineers dont need to be programming experts to build and implement high-quality software.
else
Lout = L;
end
They can focus on their technical engineering expertise for designing the functionality of technical systems. MATLAB and