Hi, I am very new to Arduino and I am conducting a project where I will be controlling the magnitude of voltage going through a dielectric elastomer. This elastomer is material to build a lens, and the amount of voltage going through will determine how well it focuses. I have a model in Simulink that measures the focus parameter of a lens over time, this has been sent to a serial port i.e. in Arduino. When I connect Arduino to a voltage source, I need to get a graph of focus measure against voltage and then differentiate this graph to get the maximum. Is there a code in the Arduino library where I can do this? I know there is a 'Graph' code, will this allow me to get the variables I want in the graph?

Use the visualization in Matlab/Simulink. Add plots in your Matlab model that connects to Arduino. You are not really using the Arduino library with using the Matlab/Simulink target for Arduino. Instead a small "server" is uploaded which your model in Matlab/Simulink may "talk" to and get values from the different Arduino hardware resources; e.g. digital and analog pin, etc.