error to perform assignment

조회 수: 2 (최근 30일)
Titas Chattopadhyay
Titas Chattopadhyay 2020년 4월 3일
댓글: Mehmed Saad 2020년 4월 3일
clear all
clc
z = -1:0.2:1;
y = -1:0.2:1;
n = -2:0.4:2;
h = 3;
alpha = 0.1;
m = 11;
for j = 1:m
for i = 1:m
w1(i) = sinh(n.*pi.* (i+1));
w2(j,i) = 0.18.*(alpha + 1).*cos(((j+1).*pi)/h).*((i+1).^2 - (i+1));
w = w1(i) + w2(j,i);
end
end
plot(w1,z(1,:),'bo-','linewidth',1)
legend('W2','Z');
hold on
%grid on
plot(w,z(1,:),'r-','linewidth',1)
axis([-1 1 -1 1])
error : Unable to perform assignment because the indices on the left side are not compatible with the size
of the right side.
  댓글 수: 1
Mehmed Saad
Mehmed Saad 2020년 4월 3일
  1. w1 and w2 are not initialized
  2. n is a vector and sinh(n.*pi.*(i+1)) will give you out a vector, you are trying to assign a vector to an index of w1 which is wrong

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by