I need help writing this function

i can't wirte this on matlab i tried too many times but it is so complicated that i always make little mistakes that effects everything. Please help me.

1 Kommentar

John D'Errico
John D'Errico am 26 Mär. 2023
If you want help, then start by showing what you tried. It is easier to correct what you write than it is to write code from scratch, and you will learn more.
And if one expression is too large, then start by learning how to break it into pieces. For example, can you write the natural log function? In MATLAB, that is just log, NOT ln. And log with the base 2 is just log2.
Break a large problem into small ones. Figure out how to write each little piece.
Eat a programming elephant one byte at a time.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

DGM
DGM am 26 Mär. 2023
Bearbeitet: DGM am 26 Mär. 2023

0 Stimmen

Break it down into constituent terms to make it easier to write. See if this is what you're after.
% some fake data
x = 1:10;
y = x+1;
% the terms
t1 = 1./sqrt(1 + (1 + y.^3).^(2/3)) + 0.3;
t21 = (exp(y/5).*3.^((x-1)./y)); % the denominator is 1
t22 = cos((x.*y).^(1/3)).^2;
t23 = log2((x.^2)/4);
t3 = log(x + y);
% put it all together
z = t1 + t21.*t22.*t23 + t3;

Kategorien

Mehr zu Genomics and Next Generation Sequencing finden Sie in Hilfe-Center und File Exchange

Tags

Gefragt:

am 26 Mär. 2023

Bearbeitet:

DGM
am 26 Mär. 2023

Community Treasure Hunt

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

Start Hunting!

Translated by