error to perform assignment

4 vues (au cours des 30 derniers jours)
Titas Chattopadhyay
Titas Chattopadhyay le 3 Avr 2020
Commenté : Mehmed Saad le 3 Avr 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 commentaire
Mehmed Saad
Mehmed Saad le 3 Avr 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

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by