Question

I have solved a Differential equation(Iteratively, not using a matlab solver) in a rectangular Domain of Length [0 1]x[0 2] and stored the values in Matlab Array. I now want to plot it in contourf but the axis labels are still the matrix index (i,j). How do I change them to 0,1 and 0,2 .... tried already axis( ).

Was it helpful?

Solution

data = randn(8,9); %// example data
xlim = 1; %// choose as needed
ylim = 2; %// choose as needed
contourf(linspace(0,xlim,size(data,2)), linspace(0,ylim,size(data,1)), data)

Example graph:

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top