Question 1 : I want to intgerate f(x)=x-a where a is some artitrary constant
I use the MATLAB code
fun=(2) x-a
ans=intgeral(fun,0,1)
But this code is showing the error due to arbitary constant .I also tried by mentioning syms a .But still error exist.
Question 2: Usng the following code i generated the series solution for k=1:11
series1(x,t)=simplify(series1(x,t)+U(k)*(power(t,k-1)));
series2(x,t)=simplify(series2(x,t)+V(k)*(power(t,k-1)));
end
series1
series2
C1=zeros(1);
C2=zeros(1);
for x=1:11:101
e=(x-1);
for t=1:5:31
f=(t-1)/10;
C1(x,t)=series1(e,f);
end
end
vpa(C1,15)
The answer are displayed, but it is displayed in the different form you can check the attachment. I want continous values.

댓글 수: 3

Image Analyst
Image Analyst 2021년 11월 27일
What we get is
Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices,
use brackets instead of parentheses.
Your fun line is not correct syntax.
Also, the code you gave never defines a value for "a". What did you assign to a, and where did you do that assignment?
Please give the actual code you used.
DGM
DGM 2021년 11월 27일
편집: DGM 2021년 11월 27일
It depends if you want to do this numerically or symbolically
% symbolically
syms x a
f = x-a;
int(f,0,1) % answer is a function of a
ans = 
% numerically
a = 0; % have to define a
f = @(x) x-a;
integral(f,0,1) % answer is just a constant
ans = 0.5000
The second part with the series stuff, I don't know, since half the code is missing.
Image Analyst
Image Analyst 2021년 11월 27일
Probably right @DGM, so you should put it in the Answers section below so he can accept it to award you reputation points for it. @YOGESHWARI PATEL, click "Show older comments" to see his answer.

댓글을 달려면 로그인하십시오.

 채택된 답변

DGM
DGM 2021년 11월 27일

0 개 추천

It depends if you want to do this numerically or symbolically
% symbolically
syms x a
f = x-a;
int(f,0,1) % answer is a function of a
ans = 
% numerically
a = 0; % have to define a
f = @(x) x-a;
integral(f,0,1) % answer is just a constant
ans = 0.5000
The second part with the series stuff, I don't know, since half the code is missing.

댓글 수: 6

YOGESHWARI PATEL
YOGESHWARI PATEL 2021년 11월 27일
Thank you for your reply.
the second code
syms x t
for k=1:10
U(k)=(-x)^k-1/(factorial(k))
end
for k=1:9
series1(x,t)=simplify(series1(x,t)+U(k)*(power(t,k-1)));
end
series1
C1=zeros(1);
for x=1:11:101
e=(x-1);
for t=1:5:31
f=(t-1)/10;
C1(x,t)=series1(e,f);
end
end
vpa(C1,15)
DGM
DGM 2021년 11월 27일
What is series1?
YOGESHWARI PATEL
YOGESHWARI PATEL 2021년 11월 28일
I put a new code in which i mention the the value of coefficient of series
DGM
DGM 2021년 11월 28일
Where is it defined?
YOGESHWARI PATEL
YOGESHWARI PATEL 2021년 11월 28일
comment section
The comment above and the original post are the only places where the variable 'series1' is mentioned.
syms x t
for k=1:10
U(k)=(-x)^k-1/(factorial(k))
end
for k=1:9
series1(x,t)=simplify(series1(x,t)+U(k)*(power(t,k-1)));
end
% ...
Here, series1 is used before it's defined. If you're trying to do something with symbolic functions, you might by over my head, but all I know is that this throws an error.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Symbolic Computations in MATLAB에 대해 자세히 알아보기

태그

질문:

2021년 11월 27일

댓글:

DGM
2021년 11월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by