Index exceeds the number of array elements (35).

조회 수: 1 (최근 30일)
Jeel Khatiwala
Jeel Khatiwala 2019년 11월 19일
댓글: Stephen23 2019년 11월 19일
x=0:6
Ta=30.2
To=69.0
k=0.04
e=1.04
y=Ta+(To-Ta)*e.^(x*(-k))
y2=log(y-Ta)
subplot(1,2,1)
plot(x,y)
xlabel=('estimated time--->')
ylabel=('tempertureT--->')
title=('temperature vs estimated time graph')
subplot(1,2,2)
plot(x,y2)
xlabel=('time--->')
ylabel=('log(T-Ta)--->')
title('log(T-Ta) vs time graph')

답변 (1개)

Stephen23
Stephen23 2019년 11월 19일
편집: Stephen23 2019년 11월 19일
You have repeatedly used syntax with an = sign, which assigns those values to some variables, e.g:
xlabel=('estimated time--->')
ylabel=('tempertureT--->')
title=('temperature vs estimated time graph')
Whereas I suspect that you really wanted to just call those functions (note: no = sign):
xlabel('estimated time--->')
ylabel('tempertureT--->')
title('temperature vs estimated time graph')
Once you have assigned a variable named title (or xlabel or ylabel or ...) then you will not be able to call the title (or xlabel or ylabel or ...) function.
Solution: call those functions properly, clear your workspace, and try again.
  댓글 수: 2
Stephen23
Stephen23 2019년 11월 19일
Jeel Khatiwala's "Answer" moved here:
x=0:6
Ta=30.2
To=69.0
k=0.04
e=1.04
y=Ta+(To-Ta)*e.^(x*(-k))
y2=log(y-Ta)
subplot(1,2,1)
plot(x,y)
xlabel=('estimated time--->')
ylabel=('tempertureT--->')
A=('temperature vs estimated time graph')
subplot(1,2,2)
plot(x,y2)
xlabel=('time--->')
ylabel=('log(T-Ta)--->')
title('log(T-Ta) vs time graph')
Stephen23
Stephen23 2019년 11월 19일
@Jeel Khatiwala: you fixed the title functions, but not the xlabel and ylabel functions.

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

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by