필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Error using plot Vectors must be the same lengths.

조회 수: 1 (최근 30일)
vetri veeran
vetri veeran 2015년 6월 17일
마감: MATLAB Answer Bot 2021년 8월 20일
I am getting error as,
Error using plot
Vectors must be the same lengths.
Error in plot(v,I,'r');
My code:
clc;
clear all;
close all;
w=1;
i=1;
M1=2e6;
M2=2e9;
for t=0:0.2:4*pi
v(i)=2*sin(w*t);
if (v(i)>=1.5)
M = M1;
if (v(i)<-1.5)
M = M2;
end
I(i)= v(i)/M;
i=i+1;
end
end
figure;
plot(v,I,'r');
Can anyone help me.
Thank you in advance

답변 (1개)

Walter Roberson
Walter Roberson 2015년 6월 17일
If you put your code into the MATLAB editor and highlight it and ask for Smart Indent, then if you look at the indentation it should be obvious where your code is wrong.

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by