- Details
- Parent Category: Programming Assignments' Solutions
We Helped With This MATLAB Programming Assignment: Have A Similar One?

Category | Programming |
---|---|
Subject | MATLAB |
Difficulty | Graduate |
Status | Solved |
More Info | Do My Matlab Homework For Me |
Short Assignment Requirements
Assignment Description
HOMEWORK ASSIGNMENT
Dynamic ANN Model for MAGNETIC LEVITATION
ANN can be used for
• Input-Output Time-Series Prediction,
• Forecasting,
• Dynamic modelling,
• Nonlinear autoregression,
• System identification and
• Filtering problems
These problems generally consist of predicting the next value of output(s) based on input(s) and output(s). Past values of both inputs/outputs may be used to predict the target series (NARX).
As HW assignment, use magnetic levitation data set and train a NN to predict five-step ahead output of the system 𝑦̂(𝑘+5)
MAGNETIC LEVITATION
The equation of motion for this system is
where y(t) is the distance of the magnet above the electromagnet, i(t) is the current flowing in the electromagnet, M is the mass of the magnet, and g is the gravitational constant. The parameter is a viscous friction coefficient that is determined by the material in which the magnet moves, and is a field strength constant that is determined by the number of turns of wire on the electromagnet and the strength of the magnet.
Load maglev_dataset.MAT loads these two variables:
maglevInputs - a 1x4001 cell array of scalar values representing 4001 timesteps of electromagnet current.
maglevTargets - a 1x4001 cell array of scalar values representing 4001 timesteps of levitated magnet position.
OR
[X,T] = maglev_dataset loads the inputs and targets into variables of your own choosing.
This dataset can be used to train a neural network to predict the vertical position of a levitated magnet from past values of its position and a control current through an electromagnet over which the levitated magnet is suspended.
You cannot use NARX feature of NN Toolbox, you need to write your own m file.
Prepare tarining data by using past values of data such as [u(k) u(k-1)……y(k-1)….]
Please pay attention to points given below:
1. Change the number of training data by resampling, check the effect on training
2. Assume you do not know the system order and try different number of delays
3. Try different number of layers and number of neurons
4. Try different type of activation function
5. Use at least one 1st order Training algorithm such as traingdx
6. Observe the effect of Epochs on the training (underfitting/overfitting)
7. Comment on the Training and validation result, try using ploterrcorr(E), plotperform and plotresponse
NOTES:
You may let Matlab function to divide data to stop overtraining but do not let MATLAB stop the training prematurely.
Use reasonable high number of epochs for 1st order gradient based training algorithms.
Obtain at least one good result with a training algorithm other than LM.
**FINALLY prepare a sinusoidal input and predict 𝐲̂(𝐤+𝟓)using your NN** Make your own final decision about the NN structure and results. Explain and comment on your results at the end of the report.
GOOD LUCK
Sample program to plot input vs output
%Magnetic Levitation close all
clear all
load maglev_dataset.mat; [x,t] = maglev_dataset; u= cell2mat(x); %current as input
y=cell2mat(t); %position as output
%plot figure TS = size(x,2);
plot(1:TS,cell2mat(x),'b',1:TS,cell2mat(t),'r') legend('Current','Distance'); grid
%PREPARE DATA
tr_indata=[u(5:1:2001); u(4:1:2000); y(4:1:2000) ]; %[u(k) u(k-1) y(k-1)] tr_outdata=y(5:1:2001); %y(k)