Effacer les filtres
Effacer les filtres

Function failed to evaluate on array inputs; vectorizing the function may speed up its evaluation and avoid the need to loop over array elements

8 vues (au cours des 30 derniers jours)
I need to create a selection of plots for 5 different values of v however with the below code I get a several copies of the same plot as well as the above error message. Does anyone know what is wrong? or a faster way?
a = char('a')
v = 0.0
V = 1+v;
g = @(a) (2048*(V.^4) + 128*(V.^2)*a.^6 + a.^12 + 16*V*sqrt(16384*(V.^6) + 2048*(V.^4)*a.^6 + 80*(V.^2)*a.^12 + a.^18)).^(1/3);
r =@(a) (1/16*V)*( a.^4 + a.^8./g(a) + g(a) );
alpha= @(a) (a/r(a));
A= @(a) 2*pi*(r(a).^2)*(1+sqrt(1-alpha(a).^2));
eps = @(a) 1/2*(A(a)/(4*pi-pi*a.^2)-1);
w = @(a) (1-cos (sin(alpha(a))))*eps(a) + (eps(a).^2);
hold all
%plot w with respect to a between 0.3-0.8 for v=0.00, 0.02, 0.03, 0.04,
%0.05 on seperate graphs
ezplot(w,[0.3,0.8])
clear v
v=0.02
figure
ezplot(w,[0.3,0.8])
etc.......

Réponses (0)

Catégories

En savoir plus sur Graphics Object Programming dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by