Error using * Inner matrix dimensions must agree.

3 ビュー (過去 30 日間)
Krystian Leszkowicz
Krystian Leszkowicz 2019 年 1 月 30 日
回答済み: Krystian Leszkowicz 2019 年 1 月 30 日
Hello everyone. Could someone explain why this error is occuring here and correct my code.
I have no idea why dimension problem came out here. I would aprreciate for any conclunsions about it
clc;
clear all;
x1=0:0.001:1;
x2=1:0.001:10;
y=16;
a=input('Których chcesz obrać przypadek E<Vo (1) czy E>Vo (2) ');
if a==1;
disp('Wybrano zalozenie E<Vo');
f=1/(1+((1/(4*x1*(1-x1)))*(sinh(sqrt(y*(1-x1)))^2)));
figure (1)
plot(f,x1);
grid on;
title('x1');
elseif a==2;
disp('Wybrano zalozenie E>Vo');
g=1/(1+((1/(4*x2*(x2-1)))*(sin(sqrt(y*(x2-1)))^2)));
figure (2)
plot(g,x2);
grid on;
title('x2');
end
Command window: 132.jpg

採用された回答

Adam
Adam 2019 年 1 月 30 日
編集済み: Adam 2019 年 1 月 30 日
Unless you meant matrix multiplication, in which case you likely need to transpose one side of the * then what you need is .* for element-wise multiplication.
See
doc times

その他の回答 (2 件)

madhan ravi
madhan ravi 2019 年 1 月 30 日
編集済み: madhan ravi 2019 年 1 月 30 日
  2 件のコメント
Stephen23
Stephen23 2019 年 1 月 30 日
madhan ravi
madhan ravi 2019 年 1 月 30 日
Thank you Stephen

サインインしてコメントする。


Krystian Leszkowicz
Krystian Leszkowicz 2019 年 1 月 30 日
Key to unslove this problem was to add "." before each mathemtical sign ( .*, ./).
Thank u guys a lot.

カテゴリ

Help Center および File ExchangeSimulink についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by