this programme in matlab 2017b but icant run it
조회 수: 2 (최근 30일)
이전 댓글 표시
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
Rik
2018년 8월 13일
Today I formatted your code. Next time, you can do it yourself by selecting your code and pushing the {}Code button.
채택된 답변
Tiasa Ghosh
2018년 8월 13일
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
추가 답변 (1개)
Walter Roberson
2018년 8월 13일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Calculus에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!