Filter löschen
Filter löschen

function handles for multiple equations

2 Ansichten (letzte 30 Tage)
Andrew Poissant
Andrew Poissant am 19 Apr. 2017
Beantwortet: Steven Lord am 19 Apr. 2017
I have a very simple question that I can't seem to find the answer to. I have a defined equation, P, which has a function handle t. I want to define another function, cp, that takes the function P and multiplies its value by 3.75. So I want cp(5) = 3.75*205*5. I tried to make a function handle P for cp to say it is a function of P but it did not work.
P = @(t)205*t
cp = @(P)3.75*P

Antworten (1)

Steven Lord
Steven Lord am 19 Apr. 2017
You can't multiply a number and a function handle.
You can multiply a number and the value you receive by evaluating a function handle.
P = @(t) 205*t
cp = @(t) 3.75*P(t)
cp(5)

Kategorien

Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by