error when using command "quiver"
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Augusto Gabriel da Costa Pereira
am 30 Mär. 2023
Beantwortet: Augusto Gabriel da Costa Pereira
am 7 Apr. 2023
trying to plot zonal and meridional wind data via the "quiver" command and I get the following error:
Error when using quiver (line 58) The size of X must match the size of U or the number of columns of U.
The data I used is attached (.mat) on google drive, it has 90mb, so I didn't put it here. follow the link: https://drive.google.com/open?id=18GgPs-iN3brZHQ3pZNK8GyLt4SOmemY8&authuser=costapereira620%40gmail.com&usp=drive_fs
Anyone a solution??
% load 'dat_era5_201007.mat'
%%
t1 = datetime(2007,07,1,0,0,0); % 01/jul/2007 as 00h
t2 = datetime(2007,07,31,23,0,0); % 31/jul/2007 as 23h
t = t1:hours(1):t2; % sera gerado datas no intervalo de t1 a t2
%%
cd 'H:\DADOS_SCi-MSc\DadosEra5PreComp'
data1 = load('dat_era5_201007.mat', 'u10');
data3 = load('dat_era5_201007.mat', 'v10');
u10=data1.u10;
v10=data3.v10;
u10=u10(:,:,t==t);
v10=v10(:,:,t==t);
u10mean=mean(u10,3);
v10mean=mean(v10,3);
load('dat_era5_201007.mat', 'lon');
load('dat_era5_201007.mat', 'lat');
%%
figure
[x, y]=meshgrid(lon(:,1),lat(:,1));
quiver(x,y,u10mean,v10mean)
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (1)
Cris LaPierre
am 30 Mär. 2023
Bearbeitet: Cris LaPierre
am 30 Mär. 2023
You have created x and y so that they are 53x57 arrays, but u10mean and v10mean are 57x53. As the error message says, they must be the match.
Try this instead.
[x, y]=meshgrid(lat(:,1),lon(:,1));
quiver(x,y,u10mean,v10mean)
0 Kommentare
Siehe auch
Kategorien
Mehr zu Vector Fields finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!