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
>>

 Réponse acceptée

Star Strider
Star Strider le 9 Nov 2017

1 vote

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 commentaire

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.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Programming dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by