Index exceeds matrix dimensions - Error

Hello, I am trying to plot the two functions on the same graph and am unable to label both y-axis. Could someone please tell me what I am doing wrong?
t = 0:20;
y1 = (100*sin(pi/4).*t)-(.5*9.8*t.^2);
y2 = 100*sin(pi/4)-9.8.*t;
a = plotyy(t,y1,t,y2);
title('Problem 5.26')
xlabel('time, sec')
ylabel('Position')
ylabel(a(2),'V(t) Vertical Direction')

댓글 수: 5

Adam
Adam 2014년 10월 22일
Your code works fine for me (in R2014b)
Chad Greene
Chad Greene 2014년 10월 22일
Works fine for me too in R2012b. Try typing close all; clear all at the beginning. You may have some leftover data from previous code lingering around.
Alyssa
Alyssa 2014년 10월 22일
I have R2013b. It's only the ylabel that keeps giving me trouble. The xlabel and title show up but once I put that ylabel in it gives me the error.
Alyssa
Alyssa 2014년 10월 22일
Nevermind. I ran it again and it worked. Today just isn't my day.
Guillaume
Guillaume 2014년 10월 22일
And what error is that?

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

답변 (0개)

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

태그

질문:

2014년 10월 22일

댓글:

2014년 10월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by