how to write sqrtroot power 7 ?

조회 수: 6 (최근 30일)
Grégoire
Grégoire 2024년 2월 22일
댓글: DGM 2024년 2월 22일
Hi,
i m trying to write this function in MatLab g(x) = sqrt^7(14x-7) but i don t know how to write the power of a root.
I would love to learn how to do it,
thanks

채택된 답변

Dyuman Joshi
Dyuman Joshi 2024년 2월 22일
편집: Dyuman Joshi 2024년 2월 22일
Use power, .^ and define a Function Handle -
g = @(x) sqrt(14.*x - 7).^7
g = function_handle with value:
@(x)sqrt(14.*x-7).^7
g(2)
ans = 4.2439e+04
g(1/2)
ans = 0
g([1/2 2])
ans = 1×2
1.0e+04 * 0 4.2439
I suggest you take the free MATLAB Onramp tutorial to learn the syntax and basics of MATLAB.
  댓글 수: 2
Grégoire
Grégoire 2024년 2월 22일
thanks !
DGM
DGM 2024년 2월 22일
You sure you're looking for
(14*x - 7)^(7/2)
instead of
(14*x - 7)^(1/7)

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

추가 답변 (2개)

Hassaan
Hassaan 2024년 2월 22일
편집: Hassaan 2024년 2월 22일
x = 2; % Example value for x
resultFromRootFunction = nthroot(14*x - 7, 7);
resultFromPowerFunction = (14*x - 7)^(1/7);
disp(['Using nthroot: ' num2str(resultFromRootFunction)]);
Using nthroot: 1.5449
disp(['Using power operator: ' num2str(resultFromPowerFunction)]);
Using power operator: 1.5449
MATLAB Basic Training:
To learn about MATLAB basic
References:
-----------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
It's important to note that the advice and code are based on limited information and meant for educational purposes. Users should verify and adapt the code to their specific needs, ensuring compatibility and adherence to ethical standards.
Professional Interests
  • Technical Services and Consulting
  • Embedded Systems | Firmware Developement | Simulations
  • Electrical and Electronics Engineering
Feel free to contact me.

Sam Chak
Sam Chak 2024년 2월 22일
@Grégoire, If you mean this function:
then you can use the function handle:
g = @(x) (sqrt(14*x - 7)).^7;
x = 0.5:0.01:1;
plot(x, g(x)), grid on, xlabel x, ylabel g(x)

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by