필터 지우기
필터 지우기

Inserting and equation and plotting it

조회 수: 1 (최근 30일)
abdo
abdo 2012년 11월 25일
i'm trying to insert an equation and plot it, but i couldn't because i keep getting errors like : matrix dimensions must agree, or inner matrix dimensions must agree.
this is the equation. M has a value of 1 to 5 with an increment of 0.5. Q has a value of 0 to 1 with an increment of 0.1.
the plot is something like this.
thank you in advance, i would appreciate your help

답변 (2개)

moulay
moulay 2012년 11월 25일
Hi!
that is true. length(M)=9 and length (Q)=11. you should take the same length of both vectors. for example Q=0:0.1:0.8!
  댓글 수: 1
abdo
abdo 2012년 11월 25일
thanx for your reply ok i fixed that issue,i tried to split the equation into parts so it would be easier for me to insert it. lets say (d) represents a part d=q/2*m-arccossqrt(1-(q/m)^2); and it gets me this error 1. error using * the inner matrix dimensions must agree thanx in advance

댓글을 달려면 로그인하십시오.


bym
bym 2012년 11월 25일
use the dot notation to specify element-by-element multiplication/division/exponentiation as in:
d= q./(2*m)-acos(sqrt(1-(q./m).^2))
  댓글 수: 2
abdo
abdo 2012년 11월 25일
thank you, now i have another error for the next part
e=q./m(1-sqrt(1-(q./m).^2));
Subscript indices must either be real positive integers or logicals.
bym
bym 2012년 11월 27일
yes, you are missing a multiplication. I think what you want is
e = (m./q).*(1-sqrt(1-(q./m).^2))

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by