Rescaling time vector in 2d
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
i have a 2d matrices and i am visualizing them using imagesc; (x vector is time) and the x vector is [1 200] i wand to rescale it to be [-1.4 2.4] and visualizing them new time vector. How to do so?
0 commentaires
Réponse acceptée
Voss
le 29 Jan 2022
If I understand correctly, here's how you can rescale a matrix to be from -1.4 to 2.4 instead of from 1 to 200:
A = reshape(1:200,10,20); % a 2D matrix with values from 1 to 200
x = [1 200];
new_x = [-1.4 2.4];
new_A = (A-x(1))./(x(2)-x(1)).*(new_x(2)-new_x(1))+new_x(1);
disp(A); disp(new_A);
It is entirely possible that I do not understand correctly, in which case, can you please clarify what you want to do? Specifically, how is x related to your matrices?
3 commentaires
Voss
le 29 Jan 2022
Oh, ok. In that case, you can set the XData of the image in imagesc():
imagesc(rand(60,200),'XData',[-1.4 2.4])
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Resizing and Reshaping Matrices dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!