Differentiate and store results in matrix
3 views (last 30 days)
I have two matrices. The first matrix is Density and it 311x1. The second matrix is Temperature and it is 311x21. The column in density matrix corresponds to each distinct column in temperature matrix.
So if I want to plot the first line I could just do:
and second line would just be:
How can I create a new matrix that takes the derivative of each temperature line (isotherm) with respect to density, and put this in a new matrix, such as diffTemperature?
Star Strider on 5 Nov 2018
Density = (0:310)'; % Create Data
Temperature = sin((0:310)'*(0:20)*2*pi/20); % Create Data
dTdD = gradient(Temperature, mean(diff(Density))); % Equal Spacing
dTdD = gradient(Temperature) ./ gradient(Density); % Unequal Spacing