jeudi 12 octobre 2023

Create an N by 1 Function Handle of All Zeros Except at one Desired Location MATLAB

I have the following function handle:

f = @(t)f_0.*sin(alpha.*t).*cos(beta.*t);

I want to create an N by 1 function handle "array" called F (I know that you can't have an array of function handles in MATLAB) that places f at any random index position within the function handle "array." All other entries should be zero. N is any integer value.

For example, if N = 3, the correct solution is:

F = @(t) [f(t); 0; 0]

What is the best way to do this for any arbitrary N?




Aucun commentaire:

Enregistrer un commentaire