Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
If any one can remove the error from this code.when i run this code it is showing the following error
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
u_xt = @(x,t,a,b) exp(a*t+b*x); % Create a function handle
x=[0:0.1:1]; %NOTE: I chose the step-size here as 0.1
t=[0:0.1:1]; %NOTE: Since your boundary conditions for x and t are identical [0 1] the step size has to be same for both
a = 5; % (say)
b = 2; % (say)
result = u_xt(x,t,a,b);
plot(u_xt,x);
% If you want to plot both on the same figure
%hold on;
%plot(u_xt,t);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Error using plot
Conversion to double from function_handle is not possible.
.
Error in ROUGH (line 7)
plot(u_xt,x);
1 comentario
Respuestas (1)
Roger Stafford
el 14 de Feb. de 2016
As the error message indicates, you are erroneously using a function handle, namely 'u_xt', as though it were an array that could be plotted. This you cannot do. In place of 'u_xt' in the 'plot' functions you should have 'result' - it is a true array and 'plot' would accept it:
plot(result,x)
0 comentarios
La pregunta está cerrada.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!