Azzera filtri
Azzera filtri

whats the problem in error 11

2 visualizzazioni (ultimi 30 giorni)
gowshya
gowshya il 8 Set 2023
Commentato: Les Beckham il 8 Set 2023
clc
clear all
s=[0 0.2 0.4 0.6 0.8 1];
y=[0 0.74 0.96 0.98 0.81 0];
x=[0 0.63 0.77 0.86 0.93 1];
t=[ 3.12 1.91 1.43 1.17 1];
m=[ 1.70 1.22 0.88 0.57 0];
yyaxis left
plot(s,y,':bo',s,x,':ro');
yyaxis right
plot(s,t,':go',s,m,':yo');
Error using plot
Vectors must be the same length.

Risposte (1)

Walter Roberson
Walter Roberson il 8 Set 2023
Your t and m have fewer elements than your s, so you cannot plot t against s or m against s. You could plot t against m
  2 Commenti
Walter Roberson
Walter Roberson il 8 Set 2023
guessing
s=[0 0.2 0.4 0.6 0.8 1];
y=[0 0.74 0.96 0.98 0.81 0];
x=[0 0.63 0.77 0.86 0.93 1];
t=[ 3.12 1.91 1.43 1.17 1];
m=[ 1.70 1.22 0.88 0.57 0];
yyaxis left
plot(s,y,':bo',s,x,':ro');
yyaxis right
smid = (s(1:end-1)+s(2:end))/2;
plot(smid, t, ':go', smid, m, ':mo');
Les Beckham
Les Beckham il 8 Set 2023
Here's another guess
clc
clear all
s=[0 0.2 0.4 0.6 0.8 1];
y=[0 0.74 0.96 0.98 0.81 0];
x=[0 0.63 0.77 0.86 0.93 1];
% t=[ 3.12 1.91 1.43 1.17 1];
% m=[ 1.70 1.22 0.88 0.57 0];
t=[0 3.12 1.91 1.43 1.17 1]; % << added a datapoint at zero
m=[0 1.70 1.22 0.88 0.57 0]; % << added a datapoint at zero
yyaxis left
plot(s,y,':bo',s,x,':ro');
yyaxis right
plot(s,t,':go',s,m,':yo');
grid on

Accedi per commentare.

Categorie

Scopri di più su MATLAB in Help Center e File Exchange

Prodotti


Release

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by