Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

can you help me with solving the problem?

1 Ansicht (letzte 30 Tage)
Phanuphong
Phanuphong am 23 Nov. 2014
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
r = 0 : 0.01 :2;
t = 0.1 : 0.1 : 1;
K = (r^2)/(sqrt((1-r^2)^2+(2*t*r)^2));
plot(r,K);
K is error. Error using ==> mpower........ Matrix must be square.

Antworten (1)

Star Strider
Star Strider am 23 Nov. 2014
You have to vectorise your ‘K’ assignment, and ‘r’ and ‘t’ must have the same number of elements.
This works:
r = linspace(0,2);
t = linspace(0,1);
K = (r.^2)./(sqrt((1-r.^2).^2+(2*t.*r).^2));
plot(r,K);
Vectorising does element-wise operations, and uses the dot operator to indicate it, such as replacing (*) with (.*), (^) with (.^), and (/) with (./).

Community Treasure Hunt

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

Start Hunting!

Translated by