How to write a script for the following

hi everyone, i was just introduced to MatLab and want to how to write a script for the question bellow
A certain mechanical system has the process function f(x)=5t^4-4^t-t^2-t+5. Write a MATLab script that will be able to evaluate the state of the system at the point t=3

댓글 수: 3

hint: matlab has no implied multiplication. 3y would be written 3*y
Image Analyst
Image Analyst 2022년 3월 15일
Your function f takes an input of x but the definition of f does not involve x at all, just t and some scalars. Why does it say x???
Jan
Jan 2022년 3월 15일
Or with other words: define it as f(t).
Search for "anonymous functions" in the documentations. The command docsearch will be useful.

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

답변 (1개)

Voss
Voss 2022년 4월 30일

0 개 추천

f = @(t)5*t.^4-4.^t-t.^2-t+5;
f(3)
ans = 334

카테고리

도움말 센터File Exchange에서 Programming에 대해 자세히 알아보기

질문:

2022년 3월 14일

답변:

2022년 4월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by