# Please help me convert equation to matlab code.

24 visualizzazioni (ultimi 30 giorni)
adi putra il 1 Apr 2018
Commentato: Walter Roberson il 18 Ago 2022
Questo/a domanda è stato/a segnalato/a da 2 collaboratori
Deal all.
I need you help to convert this equation to matlab code
I spend a lot of time to write it but it doesn't work. Thank you.
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
Walter Roberson il 1 Apr 2018
Are you permitted to use the symbolic toolbox?
Is the question about providing some kind of symbolic proof, or is it about calculation of the formula using finite precision and a particular numeric input?

Accedi per commentare.

### Risposte (8)

Birdman il 1 Apr 2018
Modificato: Birdman il 1 Apr 2018
Basically, Symbolic Toolbox will help you:
syms y(x) n
f(x)=symsum((-1).^n*(x.^(2*n+1))/factorial(2*n+1),n,0,Inf)
##### 4 CommentiMostra 2 commenti meno recentiNascondi 2 commenti meno recenti
Roger Stafford il 1 Apr 2018
@Birdman: I think you meant f(pi/2)
Birdman il 1 Apr 2018
Yes, I just now edited it Roger.

Accedi per commentare.

Roger Stafford il 1 Apr 2018
N = 100; % <-- Choose some large number
s = x;
for n = 2*N-1:-2:1
s = x - s*x^2/((n+2)*(n+1));
end
(I think you meant to take the limit as N approaches infinity, not x.)
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

kalai selvi il 15 Set 2020
pls answer this question ...how to write the equation into code
##### 2 CommentiMostra NessunoNascondi Nessuno
John D'Errico il 15 Set 2020
Please don't post a completely distinct question as an answer.
Walter Roberson il 15 Set 2020
π is written as pi in MATLAB.
exp of an expression is written as exp(expression) in MATLAB.
is written as sqrt(expression) in MATLAB.

Accedi per commentare.

kalai selvi il 16 Set 2020
How to write a code on IOTA filter in fbmc system
##### 2 CommentiMostra NessunoNascondi Nessuno
Walter Roberson il 16 Set 2020
Modificato: Walter Roberson il 17 Set 2020
Warning: pudn has questionable security. Take precautions when you access it.
kalai selvi il 23 Set 2020
thank you

Accedi per commentare.

Kunwar Pal Singh il 26 Apr 2021
please answer this....how to write this equation into MATLAB CODE
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
Walter Roberson il 26 Apr 2021
%these variables must be defined in a way appropriate for your situation
S_N = rand() * 10
theta = randn() * 2 * pi
l = randi([2 10])
b_1 = rand()
c_11 = rand()
t_year = randi([1950 2049])
d_11 = rand()
t_1 = rand()
t_x = t_1 + rand()
lambda_a = randi([500 579])
LOTF_a = rand()
P = rand()
K_l = rand()
k_0 = rand()
t_tau = randi(10)
overhaulcost_a = 1000 + rand()*100
%the work
syms t
part1 = int(S_N .* cos(theta) .* l .* b_1 .* t_year .* d_11, t, t_1, t_x);
part2 = int(lambda_a .* LOTF_a, t, t_1, t_x);
part3 = int(P*K_l .* t_year + P .* k_0 .* l .* l .* t_tau, t, t_1, t_x);
part4 = overhaulcost_a ;
result = part1 - part2 - part3 - part4;

Accedi per commentare.

Jakub Laznovsky il 19 Mag 2021
Hi guys, can you please help me with conversion this piece of code to the mathematical equation?
It i a simple 3D mask proceeding the image, and searching for adjoining number one and number two. Thank you in advance.
Code:
m1=[0 0 0; 0 1 0; 0 0 0];
m2=[0 1 0; 1 1 1; 0 1 0];
mask=zeros(3,3,3);
mask(:,:,1)=m1;mask(:,:,2)=m2;mask(:,:,3)=m1;
for i=2:size(image,1)-1
for j=2:size(image,2)-1
for k=2:size(image,3)-1
help_var=image(i-1:i+1,j-1:j+1,k-1:k+1);
if sum(unique(help_var(mask==1)))==3
new_image(i,j,k)=3; %marks adjoining pixel with number 3
end
end
end
end
##### 4 CommentiMostra 2 commenti meno recentiNascondi 2 commenti meno recenti
Walter Roberson il 22 Mag 2021
Jakub il 22 Mag 2021
Thanks a lot!

Accedi per commentare.

Adhin Abhi il 4 Gen 2022
(λlog vmax−log vmin) /(vmax−vmin )
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
Walter Roberson il 4 Gen 2022
(lambda .* log(vmax) - log(vmin)) ./ (vmax - vmin)

Accedi per commentare.

Lukasz Sarnacki il 17 Ago 2022
Please help
##### 5 CommentiMostra 3 commenti meno recentiNascondi 3 commenti meno recenti
Lukasz Sarnacki il 17 Ago 2022
Thay all are arrays
A(x; y) is the average intensity of the fringe image
B(x; y) is the so-called intensity modulation.
ϕ is the corresponding wrapped phase
Walter Roberson il 18 Ago 2022
syms n N integer
syms A(x,y) B(x,y) phi(x,y)
Pi = sym(pi)
Pi =
π
I(n,x,y) = A(x, y) + B(x,y) * cos(phi(x,y) - 2*Pi*n/N)
I(n, x, y) =
numerator = simplify(symsum(I(n, x, y) .* sin(2*Pi*n/N), n, 0, N-1))
numerator =
denominator = simplify(symsum(I(n, x, y) .* cos(2*Pi*n/N), n, 0, N-1))
denominator =
eqn = phi(x,y) == atan(numerator ./ denominator)
eqn =
simplify(eqn)
ans =

Accedi per commentare.

### Categorie

Scopri di più su Calculus in Help Center e File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by