Error message with arrays
조회 수: 1 (최근 30일)
이전 댓글 표시
clear all
clc
close all
h = [2:20:220];
t_a = 293;
t_s = [];
q_flux = 800;
n = length(h);
for i = 1:n
t_s = q_flux./h+t_a;
y(i) = t_s;
i = i+1;
end
plot(h,y)
When running this i obtain the following error message:
Unable to perform assignment because the indices on the left side are not compatible with the size of
the right side.
Error in a2 (line 13)
y(i) = t_s;
what can i do different?
댓글 수: 0
답변 (1개)
Alan Stevens
2022년 1월 26일
You only need
h = [2:20:220];
t_a = 293;
q_flux = 800;
n = length(h);
y = q_flux./h+t_a;
i = i+1;
plot(h,y)
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Target & Compiler에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!