File Exchange

image thumbnail


version 1.0.0 (17.1 KB) by Aitor Gastaminza
Corrosion current calculation for Closed Polarisation Tests


Updated 06 Apr 2019

From GitHub

View license on GitHub

The following project aims to help corrosion researches with the determination of the corrosion current during Closed Polarisation Test.
The program will read data files of the different tests in a folder with the following structure: txt data with 4 columns, with the 3rd and 4th column being the scan Potential and Measured current, respectively. (Feel free to adapt it to your code)
It will extract the name of each of the test files with the following structure: data - ref electrode - channel - test number - test type - corrosive media (Feel free to adapt it too)
% - Clean up the noisy data acquired with a smoothing filter
% - Remove the extreme parts far from the corrosion potential and keep only the values inside the region "delta" of study
% - Get a double exponential equation that approaches the actual data log
% - Get the tangent equations in the value "tafvalue" for each of the anodic and cathodic branches
% - Get the intersection of the two tangents, so that a value of Potential & Current is obtained.
% - The potential value is compared to the corrosion potential and the difference is spotted.
% - If the difference is bigger than 2mV, run a loop to change the value on which the tangents are calculated.
% - The final value is returned to the user and recorded if interested into an excel.
% - Logaritmich plots are created to compare the difference between the real data and the tangent data, so that the user can compare the range of linearity

Cite As

Aitor Gastaminza (2021). Corrosion-current-calculation-with-tafel-lines (, GitHub. Retrieved .

Comments and Ratings (1)

Asep Setiawan

Thank you for the fantasting code. I have a question for you. How to prepare the experiment file for the analysis?
based on your guidance, the file shall consist 4 column, with the 3rd and 4th column being the scan Potential and Measured current.
I have prepared it accordingly, however, I still got the following error. FYi, I fill my 1st and 2nd column with 0 number. I dont put any title on each column.

Undefined function or variable 'prompt'.

Error in readfilesCPP (line 29)
izena(i)=prompt('Input a name please:' );

Error in main_tafel (line 77)
[L,names]=readfilesCPP(theFiles, myFolder,V);

Thank you for your help

MATLAB Release Compatibility
Created with R2018a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!