error when using command "quiver"
1 view (last 30 days)
Show older comments
Augusto Gabriel da Costa Pereira
on 30 Mar 2023
Answered: Augusto Gabriel da Costa Pereira
on 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 Comments
Accepted Answer
More Answers (1)
Cris LaPierre
on 30 Mar 2023
Edited: Cris LaPierre
on 30 Mar 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 Comments
See Also
Categories
Find more on Vector Fields in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!