error when using command "quiver"

조회 수: 1 (최근 30일)
Augusto Gabriel da Costa Pereira
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)

채택된 답변

Augusto Gabriel da Costa Pereira
if you perform the following tweak it will work fine
figure
imagesc(lon(:,1),lat(:,1),v10mean)
[x, y]=meshgrid(lon(:,1),lat(:,1))
hold on
h=quiver(x,y,u10mean',v10mean','w')

추가 답변 (1개)

Cris LaPierre
Cris LaPierre 2023년 3월 30일
편집: Cris LaPierre 2023년 3월 30일
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)

카테고리

Help CenterFile Exchange에서 Vector Fields에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by