error to perform assignment

2 次查看(过去 30 天)
Titas Chattopadhyay
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