how can I solve Undefined operator '^' for input arguments of type 'function_handle'. problem?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
María Pía Melchor Giménez
el 2 de Abr. de 2017
Respondida: Walter Roberson
el 2 de Abr. de 2017
h=0.1;
a=5.02;
b=9.13;
c=35.7;
t=0:h:100;
l=length(t);
v=@(t) (a*t ^(a-1))/(c ^a)*cosh(b*t/100)+((t/c) ^a)*(b/100)*sinh(b*t/100);
y=@(t) ((t/c) ^a)*cosh(b*h/100)
alt=zeros(1,l);
accd=zeros(1,l);
accel=zeros(1,l);
ateor=zeros(1,l);
a=@(t) 3.24006e-7*x ^(3.02)
for i=1:l
accd=(-3*v(t(i))+4*v(t(i)+h)-v(t(i)+2*h))/(2*h);
end
for i=1:l
alt(i)=((t(i)/c) ^a)*cosh(b*h/100);
accel(i)=(y(t(i)+h)-2*y(t(i))+y(t(i)-h))/(h ^2)
ateor(i)=a(t(i));
end
plot(t,accd)
hold on
plot(t,accel,'r')
plot(t,ateor,'g')
legend('accd','accel','ateor')
xlabel('Time')
ylabel('Acceleration')
0 comentarios
Respuesta aceptada
Walter Roberson
el 2 de Abr. de 2017
alt(i)=((t(i)/c) ^a(t(i)))*cosh(b*h/100);
Notice you had to invoke a at t(i) -- which you did do properly two lines further below.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!