error to perform assignment

3 views (last 30 days)
Titas Chattopadhyay
Titas Chattopadhyay on 3 Apr 2020
Commented: Mehmed Saad on 3 Apr 2020
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 Comment
Mehmed Saad
Mehmed Saad on 3 Apr 2020
  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

Sign in to comment.

Answers (0)

Categories

Find more on Creating and Concatenating Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!