how to debugg the error : size input must be integers

조회 수: 1 (최근 30일)
Cassandra Soliman
Cassandra Soliman 2020년 5월 29일
답변: Tommy 2020년 5월 29일
function u = Section1_4
% This function code is to plot u(x,y) = u1(x,y)+u2(x,y)
% Description: This file is specifically plotting the centre of the domain
% The analytical solution for the Laplace Equation for section 1.4
%Input parameters
% C0 = u1(x,y)
% C2 = u2(x,y)
% The following is the spatial parameters
L = 3/2; %length of the x-dimension (we only want the centre domain)
H = 1/2; % length of the y-dimension
T_1 = -5; % temperature profile
T_2 = -10; % temperature profile
nx = 1.5; % Number of grid points x-direction
ny = 0.5; % Number of grid points in the y direction
x = linspace(0,L,nx);
y = linspace(0,H,ny);
nfs = 50;
n = 1;
k = ((n*pi)/(L));
u =ones(nx,ny); %% line were the error is
% Analytical solution
for i=1:nx
for j=1:ny
for m = 1: nfs
upper_side = ((16*T_1/((n^3)*(pi)^3)))*(((1-cos(n*pi))/sinh(k*H)))*(sinh(k*y(j)))*(sin(k*x(j)));
lower_side = ((16*T_2/((n^3)*(pi)^3)))*(((1-cos(n*pi))/sinh(-k*H))).*(sinh(k*y-k*H)).*(sin(k*x(j)));
% full solution
u(i,j) = u(i,j) + upper_side + lower_side;
end
end
end
contourf(x,y,u');
pcolor(x,y,u');
shading interp;
title('Temperature Value at the Centre of Domain');
xlabel('x');
ylabel('y');
colorbar;
surf(x,y,u');
end
  댓글 수: 2
Image Analyst
Image Analyst 2020년 5월 29일
Enough already. Can you stop posting this over and over again?
Cassandra Soliman
Cassandra Soliman 2020년 5월 29일
I apologise im just trying to debugg u = ones(nx,ny); i am unsure why i am getting an error

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

채택된 답변

Tommy
Tommy 2020년 5월 29일
nx = 1.5; % Number of grid points x-direction
ny = 0.5; % Number of grid points in the y direction
"size input must be integers"
nx and ny must be integers but aren't. What does it mean to have 0.5 grid points in the y direction?

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Motion Modeling and Coordinate Systems에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by