フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

If any one can remove the error from this code.when i run this code it is showing the following error

1 回表示 (過去 30 日間)
YOGESHWARI PATEL
YOGESHWARI PATEL 2016 年 2 月 14 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
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 件)

Roger Stafford
Roger Stafford 2016 年 2 月 14 日
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)

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by