not able to solve the integration function

Dear Sir/Madam,
I am not able to solve the given integration function. The screenshot of given is attached and the code is given below
Thank you
for j=1:100
x(j)=linspace(0,0.025,101);
R(j)=linspace(0,0.4,101);
f=0.025;
syms x
b(j)= int(R(j)-sqrt(R(j).^2-x(j).^2),0, f);
c(j)=sqrt((1/f)*b(j));
end

6 件のコメント

Kundan Prasad
Kundan Prasad 2021 年 12 月 16 日
This type of error is seen
Unable to perform assignment because the indices on the left side are not compatible with the size of
the right side.
Error in diffra (line 46)
x(j)=linspace(0,0.025,101);
Walter Roberson
Walter Roberson 2021 年 12 月 16 日
Solve for what value?
Is σ a constant?
Is the task to solve for f for each of a list of R values ?
Your vectors are length 101; why do you only loop to 100 ?
Kundan Prasad
Kundan Prasad 2021 年 12 月 16 日
σ is not constant and it varies with x.
The value of R can be taken as constant i.e. 0.4 and x should be varied from 0 to 0.025.
the upper limit of f=0.025 and lower limit is 0
I think for loop should be avoided.
Walter Roberson
Walter Roberson 2021 年 12 月 16 日
What is being solved for?
Is the question how to calculate the right hand side given R, f, and symbolic x, outputting sigma ?
Normally when the phrase "integral equation" is used, it means that some variable inside an integral or some bound of the integral needs to be modified to find the correct value to match the other side of the equation. For example,
syms x b
solb = vpasolve(int(cos(x)^2 + tan(x/10), x, 0, b) == 1)
solb = 
1.966415013513613065429486177359
Kundan Prasad
Kundan Prasad 2021 年 12 月 16 日
yes sir
for given R=0.4, f=0 & 0.025, x=0:0.001:0.025,
what will be the value of σ for each x
Kundan Prasad
Kundan Prasad 2021 年 12 月 16 日
here f=0.025

サインインしてコメントする。

回答 (2 件)

Jan
Jan 2021 年 12 月 16 日

0 投票

This cannot work:
x(j) = linspace(0,0.025,101);
On the left is a scalar and on the right a vector with 101 elements.
Seeing only the invalid code does not clarify its intention. What is the purpose of the loop?

2 件のコメント

Kundan Prasad
Kundan Prasad 2021 年 12 月 16 日
what need to be change in code. Please clarify??
Thank you
Jan
Jan 2021 年 12 月 16 日
I cannot fix the code such that it does, what you want, as long as you do not clarify what you want to achieve. I ask again: What is the purpose of the loop? I'd expect RT to be a constand and x to be a symbolic variable. Then there is no need for a loop.

サインインしてコメントする。

Tesfaye Girma
Tesfaye Girma 2021 年 12 月 16 日

0 投票

indeces should have to match in both side and be compatable as well

質問済み:

2021 年 12 月 16 日

コメント済み:

2021 年 12 月 16 日

Community Treasure Hunt

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

Start Hunting!

Translated by