# Array not in the same size

8 visualizzazioni (ultimi 30 giorni)
Syazana il 30 Lug 2023
Commentato: Walter Roberson il 30 Lug 2023
I want to plot a graph of angular velocity vs time. But the error of "Array not in the same size" appear. I already check which array not in the same same size and its show the time were in the same array. Could you help me and give me the suggestion what i can do.
s3 =sind([-45.547825 -45.512272 -45.486092... ])
c2=cosd([56.192139 56.22419 56.258484...])
c3=cosd([-45.547825 -45.512272 -45.486092...])
diff_q1t=[-0.153070611 -0.139225787 -0.124578984 ...]
diff_q2t=[ 0.053429764 0.057896935 0.061122303...]
%All s3,c2,c3, diff_q1t and diff_q2t have 198 data
disp(numel(time)); % Display the number of elements in the time array
disp(numel(s2)); % Display the number of elements in the s2 array
disp(numel(s3)); % Display the number of elements in the s3 array
disp(numel(c2)); % Display the number of elements in the c2 array
disp(numel(c3)); % Display the number of elements in the c3 array
disp(numel(diff_q1t)); % Display the number of elements in the diff_q1t array
disp(numel(diff_q2t)); % Display the number of elements in the diff_q2t array
NwA_a1=(s3.*diff_q2t + c2.*c3.*diff_q1t) %Angular velocity
figure
time = [-0.4,-0.3,-0.2,-0.1,0,0.1];
y = NwA_a1;
plot(time,y)
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposte (1)

Walter Roberson il 30 Lug 2023
You say that your c2, c3, diff_q1t, diff_q2t and s3 all have 198 data, so
NwA_a1=(s3.*diff_q2t + c2.*c3.*diff_q1t) %Angular velocity
would have 198 data.
time = [-0.4,-0.3,-0.2,-0.1,0,0.1];
That has 6 data
plot(time,y)
You are asking to plot 6 against 198.
The only way it could work is if y is 6 x 33 or 33 x 6.
##### 2 CommentiMostra NessunoNascondi Nessuno
Syazana il 30 Lug 2023
Is that another way to plot this graph if the time interval is from -0.4 to 0.1
Walter Roberson il 30 Lug 2023
time = linspace(-0.4, 0.1, numel(y));
plot(time,y)

Accedi per commentare.

### Categorie

Scopri di più su Startup and Shutdown in Help Center e File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by