Matlab Simulation

Matlab simulations has an excellent set of graphic tools for sophisticated data structures which contains built-in editing and debugging tools and also supports object oriented programming. Matlab has powerful built-in routines which allow very wide variety of computations. Matlab simulation is available for several different computer systems like Macintosh, PC and Unix platforms. Matlab simulation has Specific applications are gathered in packages which is also known as toolbox. 

 

Functions of Matlab Simulations: 

  • Input of variables from the keyboard.
  • Formatted output of variables.

 

Matrices Used in Matlab Simulations:

  • Equal Matrices
  • Empty Matrices
  • Building matrices with block
  • Square matrices

 

Uses of Image Processing Toolbox in Matlab Simulation Projects:

  • Reading Images
  • Displaying Images
  • Writing Images

Example Code for Peak Detection:

%Finding median over 100 values
N=100;
for i=1:length(testdata)-N
newvalue(i+N/2)=median(testdata(i:i+N-1));
end
%peak detection of signal – median
delta = testdata(1:length(newvalue))-newvalue’;
delta(1:N/2)=0; %% the first N/2 values should be set to zero;
plot(delta,’g’);
W = delta;
for j=1:length(delta);
x(j) = W(j)^2;
end
y = sum(x)
energy = sqrt((y/length(delta)))
threshold = (0.7*energy) %% 0.7 is an arbitrary choice
line([0 length(delta)],[threshold threshold]) %% to visualize, plot the threshold across the plot
i=1
for n=(delta(N/2) + 2):length(delta)-1
if (delta(n)>=delta(n-1) & delta(n)>=delta(n+1) )
if (delta(n)>= threshold) ;
index(i)=n;
i=i+1;
end
end
end
hold on
plot(index,delta(index),’r+’)

Operations of Matlab simulations:

  • Matrix Operations.
  • Array Operations.

 

Commands in Matlab Programming:

  • Create a File
  • Save the File
  • Run the File

 

Applications of Matlab Simulation Projects:

  • Registration Techniques
  • High Quality Color Representation
  • Video Processing
  • Image Transmission and Coding
  • Facsimile

Example Code for ELM (Extreme Learning Machine):

function [pred elmWout elmW] = elm(x_train, y_train, x_test, elmsigma, act, elmW)

dim=size(x_train,2);

if ~exist(‘elmW’,’var’)
elmW = normrnd(0, elmsigma, dim+1, numhid); % +1=bias
end;

x_aug1=[ones(size(x_train,1),1) x_train];
hidout1 = x_aug1*elmW;
hidout1 = activation(hidout1, act);
Hinv = pinv(hidout1);
elmWout = Hinv*y_train;

x_aug2=[ones(size(x_test,1),1) x_test];
hidout2 = x_aug2*elmW;
hidout2 = activation(hidout2, act);
pred = hidout2*elmWout;

function hidout = activation(hidout, act)
switch act
case ‘erf’
hidout=erf(hidout);
otherwise %’tanh’
hidout=tanh(hidout);
end;