How can I define handle function in a loop with predefined coefficient?

2 Ansichten (letzte 30 Tage)
Ashkan Rigi
Ashkan Rigi am 27 Okt. 2021
Kommentiert: Rik am 27 Okt. 2021
here is the some lines of code:
a=[1 2 3];
b=[4 5 6]
for i=1:length(a)
s_i{i}=@ (x) a(i)*x^2+b(i)*x;
I would like to take the listed below by the codes:
  1 Kommentar
Rik am 27 Okt. 2021
How doesn't this do what you want?
There is just a small syntax difference: you need to use curly braces when indexing into s.

Melden Sie sich an, um zu kommentieren.

Antworten (0)


Mehr zu Loops and Conditional Statements 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