Changing just the axis to a "log scale" one and not the image

4 vues (au cours des 30 derniers jours)
Markus Klyver
Markus Klyver le 13 Oct 2017
I have plotted a matrix newT with the image command
XRange = [0 d*100]
YRange = [0 t*dt]
image(XRange, YRange, newT, 'CDataMapping', 'scaled');
c = colorbar;
colormap('hot')
ylabel(c, 'Temperatur (Celsius)')
xlabel('x-led (cm)')
ylabel('y-led (sekund)')
newT is just a matrix with doubles, representing temperature measured in Celsius. Now, the problem is that y isn't isn't linear nor log scaled, but rather each row in newT represents the state of the system at a time H(t), as defined by the matrix H
H = [0.0033515273388872936 0.0050272910083309407 0.0083788183472182347 ...
0.011730345686105528 0.016757636694436469 0.023460691372211056 0.033515273388872939 ...
0.046921382744422112 0.067030546777745878 0.093842765488844224 0.13238532988604809 ...
0.18600976730824478 0.26141913243320891 0.36699224360815863 0.51445944651919961 ...
0.72057837786076817 1.0088097290050755 1.4126687733409942 1.9790768936129468 ...
2.771713109259792 3.8810686584314862 5.4345015800057466 7.6096428229436 ...
10.654505410322706 14.917648185387344 20.88504261227617 29.240400268122194 ...
40.937230680838852 57.312793258642166 80.238916020300692 112.33481758115487 ...
157.2687446136168]
How do I specify this on the y-axis, without changing the plot? The reason for a such solution like this is that the whole process is considered at discrete points in time, and I want to have a log y scale. So I'm forced to create this new newT where the nth row of newT is
ceil(1.4^n T(1, :))
that is, the nth row of newT is 1.4^n of the nth of the matrix T. The matrix T contains the state of the system at discrete points in time defined by
linspace(0, 196.4933, dt)
so I have to create this pseudo-log matrix newT to get a good overview of the evolution of the system over time. So what I would want to do is to change the y-axis to represent the time correctly, or find an other method of plotting the matrix T with a logarithmic scale on the y axis.
Is there anything like this in MATLAB?

Réponses (1)

Rajesh Balagam
Rajesh Balagam le 17 Oct 2017
Does changing the Y-axis tick labels work for you?
For example:
data = rand(10)*100;
image([0 100],[0 100], data, 'CDataMapping', 'scaled');
ylblVals = exp(0:10:100);
ylbls = strsplit(num2str(ylblVals, '%10.2e\n'));
yticklabels(ylbls)

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by