What is the matlab code syntax to create a temporary array in MATLAB ?
4 views (last 30 days)
I am working on the fault detection and fault classification in power system using wavelet and ANN in matlab/simulink. I need to sense the fault current from the power system model drawn in simulink, and the waveform of the fault current displayed in the scope will be converted into data and has to be stored temporarily in the form of array in workspace (as a memory) and this data samples stored in the array shall be fed to wavelet code (along with 0.05 sec time step, so that window can be made) and the wavelet code can calculate the fault coefficients and these fault coefficients can be fed to the ANN controller to detect the correct type of fault. Once the data samples is fed to the wavelet code after 0.05 sec, that data samples stored in array will be cleared and new data samples will be stored in the form of array in workspace. Again this data samples is fed to wavelet code and wavelet code will calculate the fault coefficients and after next 0.05 sec the data samples stored in the array will be cleared and new data samples will be stored in the array in workspace. In this way at every 0.05 sec time step, the data samples will be stored in the array and will be given to wavelet code and the array will be cleared and new data samples will be stored in the array. This array is called "temporary array".
The question is that how to create this temporary array in MATLAB ? What is the matlab code syntax for creating this temporary array ? I just want only suggestion. I am not asking for an exact answer.
Ganesh Gudipati on 13 Jun 2022
As per my understanding you want to create an array and at each timestep the new samples should replace the old samples.
Create a array of initial size ‘n’ using the command
tempArray = zeros(1,n);
% no of rows =1, now of columns = n;
Let us consider your model as a function. Now this function takes the tempArray and it will modify the array at each time step.
Once this whole execution is done, and the tempArray is no more required
%This removes the array from the workspace and frees the memory.
For more information refer Matrices and Arrays