this programme in matlab 2017b but icant run it
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Aalaa Abu alrob
am 13 Aug. 2018
Kommentiert: Walter Roberson
am 14 Aug. 2018
syms x;
syms E;
syms a;
p(x) =(sqrt(2*(E-potential(x,a))))
q = integral(p(x),0,x)
function [v] = potential(a,x)
v= a.*x
end
2 Kommentare
Rik
am 13 Aug. 2018
Today I formatted your code. Next time, you can do it yourself by selecting your code and pushing the {}Code button.
Akzeptierte Antwort
Tiasa Ghosh
am 13 Aug. 2018
For using Integral (), you must describe 'p' as a function handle with the '@' notation.Like this:
p = @(x) sqrt(2*(E-potential(x,a)));
This will work for Integral(). However, your second input to integral is 'x' which a symbolic variable. But Integral() accepts only scalar values as input. You need to change that.
3 Kommentare
Weitere Antworten (1)
Walter Roberson
am 13 Aug. 2018
p is defined in terms of the symbolic variable a. integral() is for numeric integration and cannot be used with unresolved symbolic variables.
Please recheck the order of parameters for your function. You define the function with one order but you call it with a different order.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Calculus finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!