Filter löschen
Filter löschen

plot 2D gride

2 Ansichten (letzte 30 Tage)
Abdulrahman Mohamed
Abdulrahman Mohamed am 5 Apr. 2022
Beantwortet: Voss am 6 Apr. 2022
I want to plot a gride of pressure distribution in x and y direction
x=1:15;
y=1:15;
Pressure=Psave; (%matrix size (1125,1))
  2 Kommentare
Akira Agata
Akira Agata am 5 Apr. 2022
Question for clarification:
Why the matrix size of the variable Pressure becomes 1125, instead of 225 (=15 x 15) ?
Abdulrahman Mohamed
Abdulrahman Mohamed am 5 Apr. 2022
sorry it is 225

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Voss
Voss am 6 Apr. 2022
x = 1:15;
y = 1:15;
% some 225x1 Pressure values:
Pressure = reshape(5000-abs(2*x-y.'),[],1);
size(Pressure)
ans = 1×2
225 1
% reshape Pressure to numel(y)-by-numel(x), 15x15.
% your reshape might have to be different, depending on how the order of
% the elements in Pressure relates to x and y
surface(x,y,reshape(Pressure,numel(y),[]));
cb = colorbar();
xlabel('x')
ylabel('y')
ylabel(cb,'Pressure')
title('Pressure')
axis tight

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by