Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
If any one can remove the error from this code.when i run this code it is showing the following error
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentar
Antworten (1)
Roger Stafford
am 14 Feb. 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 Kommentare
Diese Frage ist geschlossen.
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!