How to divide and times in matlab

조회 수: 382 (최근 30일)
u-will-neva-no
u-will-neva-no 2011년 12월 11일
답변: Zahin Akif 2020년 2월 19일
Hey everyone!
Basically im trying to write my fist line of code, in matlab, to the given formula: |G(jw) |= 1/√(R^2+(wL- 1/wC)^2 ) Now, im not sure how to get the 1/wC term as I do not know how to divide in matlab. also, how do I get the ^2? All I want is the general form as an answer. I should be able to get it from there! Thanks!

채택된 답변

bym
bym 2011년 12월 11일
* % matrix multiply
.* %scalar multiply
/ % matrix divide
./ % scalar divide
^ % exponentiation
.^ % element-by-element exponentiation
so for your equation:
1./sqrt((R.^2+(w.*L-1/(w.*c)).^2));

추가 답변 (4개)

Paulo Silva
Paulo Silva 2011년 12월 11일
1/sqrt(R^2+(w*L-1/(w*C))^2)
if perhaps you are working with arrays or vectors and you want the operations to be performed element wise you must put a period before the symbols like this:
.^
.*
./

u-will-neva-no
u-will-neva-no 2011년 12월 12일
Thanks!

Samra Sarwar
Samra Sarwar 2019년 12월 4일
L = 2500
wi = 15
τ = L/wi
Please code this in MATLAB

Zahin Akif
Zahin Akif 2020년 2월 19일
L = 2500
wi = 15
τ = L/wi

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by