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);endfor 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));endplot(t,accd)hold onplot(t,accel,'r')plot(t,ateor,'g')legend('accd','accel','ateor')xlabel('Time')ylabel('Acceleration')
MATLAB: How can I solve Undefined operator ‘^’ for input arguments of type ‘function_handle’. problem
operator problem
Related Question
- Runga Kutta Mthod 4
- Convolution of two piecewise signals returning zero (exercise 2 in attachment)
- Mix symbolic with function handle
- How to fix the error ”Conversion to function_handle from double is not possible.” for the below 3Eq euler matlab code
- OdeEueler Explicit Eurlers method
- I was writing a equation but this always have an error and i cant run it
Best Answer