i have inserted the following equation into matlab, i want values of Z for each value of w from 0.001:1000. but i keep getting a single value only. i will insert my matlab code below, i have converted the names of some values into simple a,b,c,e to make it easy for me to insert the values into matlab. ill insert some pictures what my question.
my matlab code: >> a = 1; t = 1; w = 0.001:1000; b = 10; d = 0.25; c = cos((d*pi)/2); e = w*t; z = sqrt((a.^(2)*e.^(2*d)+2*c*b*a*e.^(d)+b.^2)/(1+2*c*e.^(d)+e.^(2*d)))
z =
2.5265
>>

 채택된 답변

Star Strider
Star Strider 2017년 11월 9일

1 개 추천

You need to completely vectorise your equation, including the division:
z = sqrt((a.^(2)*e.^(2*d)+2*c*b*a*e.^(d)+b.^2)./(1+2*c*e.^(d)+e.^(2*d)));
↑ ← VECTORISE DIVISION
That should work.

댓글 수: 1

My pleasure.
Since this is homework, type:
lookfor log10
in your Command Window. Click on the result.
You could do the same for ‘plot’ (so lookfor plot). You would then see the documentation on the plot (link) function.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Programming에 대해 자세히 알아보기

질문:

2017년 11월 9일

댓글:

2017년 11월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by