필터 지우기
필터 지우기

whats the problem in error 11

조회 수: 2 (최근 30일)
gowshya
gowshya 2023년 9월 8일
댓글: Les Beckham 2023년 9월 8일
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.

답변 (1개)

Walter Roberson
Walter Roberson 2023년 9월 8일
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
Walter Roberson
Walter Roberson 2023년 9월 8일
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 2023년 9월 8일
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

댓글을 달려면 로그인하십시오.

카테고리

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

제품


릴리스

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by