Why do I keep getting "Error using plot Invalid data argument."

조회 수: 14 (최근 30일)
Ashley
Ashley 2023년 8월 26일
댓글: Walter Roberson 2023년 8월 27일
%Inputs
prompt1 = 'What is Tc?'
Tc = input(prompt1) % In degrees F
k = 0.342;
Prompt2 = 'What is Tr?'
Tr = input(Prompt2); % In degrees F
Prompt3 = 'What is Ti?'
Ti = input(Prompt3); % In degrees F
t = -1/k.*log((Tc-Tr)/(Ti-Tr)) % Equation for amount of time taken
time = linspace(0,t*2) % Time vector
Tc = Tr + (Ti - Tr)*exp(-k*t) % Equation for fridge temp
plot(time,Tc, 'r', 'd')

채택된 답변

Voss
Voss 2023년 8월 26일
편집: Voss 2023년 8월 26일

Linespec (style, color, marker) should be specified as a single argument:

plot(time,Tc, 'rd')
  댓글 수: 1
Walter Roberson
Walter Roberson 2023년 8월 27일
Unless, that is, you use name-value pairs, such as
plot(time, Tc, 'Color', 'r', 'Marker', 'd')

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

추가 답변 (0개)

카테고리

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