ํ•„ํ„ฐ ์ง€์šฐ๊ธฐ
ํ•„ํ„ฐ ์ง€์šฐ๊ธฐ

Matrix dimension must agree

์กฐํšŒ ์ˆ˜: 1 (์ตœ๊ทผ 30์ผ)
Saskia Nur Santika
Saskia Nur Santika 2020๋…„ 1์›” 9์ผ
๋Œ“๊ธ€: Saskia Nur Santika 2020๋…„ 1์›” 9์ผ
Ihave a code
xd=-(sqrt(Rยฒ-hoยฒ)):0.5:x3;
xd1=x3;
yd1=y3;
xd2=-(sqrt(Rยฒ-hoยฒ));
yd2=ho;
yd=(((xd-xd1)./(xd2-xd1)).*(yd2-yd1))+(yd1);
plot(xd,yd,'k')
The result is:
Eror using .* Matrix dimensions must agree.
Please help mee ?
*code formatted by Adam Danz; the squared superscripts are ambiguous (^2 or .^2) so I left them as-is - AD
  ๋Œ“๊ธ€ ์ˆ˜: 3
David Hill
David Hill 2020๋…„ 1์›” 9์ผ
You need to provide more information. Look at the size of each of your matrixes. If you want help you will need to provide examples of your variables.
Saskia Nur Santika
Saskia Nur Santika 2020๋…„ 1์›” 9์ผ
f=15; R=2*f; ho=12; so=10; sia=-((f*so)/(f+so)) x3=-r-sia

๋Œ“๊ธ€์„ ๋‹ฌ๋ ค๋ฉด ๋กœ๊ทธ์ธํ•˜์‹ญ์‹œ์˜ค.

์ฑ„ํƒ๋œ ๋‹ต๋ณ€

Adam Danz
Adam Danz 2020๋…„ 1์›” 9์ผ
In this line
yd = (((xd-xd1)./(xd2-xd1)).*(yd2-yd1))+(yd1);
% ^^
The terms to the left and right of .* are not the same size. The dot-asterisk notation specifies element-wise multiplication where x .* y is interpretted as x(i) * y(i). That requires that x and y are the same size.
The two lines below must produce the same output.
size(((xd-xd1)./(xd2-xd1)))
size((yd2-yd1))
  ๋Œ“๊ธ€ ์ˆ˜: 2
Saskia Nur Santika
Saskia Nur Santika 2020๋…„ 1์›” 9์ผ
Thankyouu
KALYAN ACHARJYA
KALYAN ACHARJYA 2020๋…„ 1์›” 9์ผ
If your question is answered, you can accept the answer.

๋Œ“๊ธ€์„ ๋‹ฌ๋ ค๋ฉด ๋กœ๊ทธ์ธํ•˜์‹ญ์‹œ์˜ค.

์ถ”๊ฐ€ ๋‹ต๋ณ€ (1๊ฐœ)

Mateus Banroc
Mateus Banroc 2020๋…„ 1์›” 9์ผ
Hi Saskia,
In your code, I guess that only xd and yd are vectors, right? So x3, y3, R and ho should be scalars.
I don't know what are the values of these scalars but I tried this and it worked.
R=10; ho=2;
x3=10;
y3=10;
xd=-(sqrt(R^2-ho^2)):0.5:x3;
xd1=x3;
yd1=y3;
xd2=-(sqrt(R^2-ho^2));
yd2=ho;
yd=(((xd-xd1)./(xd2-xd1)).*(yd2-yd1))+(yd1);
plot(xd,yd,'k')
You must check if R, ho, x3, y3 are scalars.
  ๋Œ“๊ธ€ ์ˆ˜: 1
Saskia Nur Santika
Saskia Nur Santika 2020๋…„ 1์›” 9์ผ
Yeah, thankyou so much.

๋Œ“๊ธ€์„ ๋‹ฌ๋ ค๋ฉด ๋กœ๊ทธ์ธํ•˜์‹ญ์‹œ์˜ค.

์นดํ…Œ๊ณ ๋ฆฌ

Help Center ๋ฐ File Exchange์—์„œ Programming์— ๋Œ€ํ•ด ์ž์„ธํžˆ ์•Œ์•„๋ณด๊ธฐ

ํƒœ๊ทธ

Community Treasure Hunt

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

Start Hunting!

Translated by