Create function from a vector in matlab

Click For Summary
SUMMARY

The discussion focuses on creating a function in MATLAB that maps a column vector 'c' to a time vector 't', where the function f(t) interpolates values from 'c' based on specified steps. The user aims to define f(t) such that f(fstep) corresponds to c(cstep), allowing for calculations like sin(t)*f(t). The implementation requires understanding MATLAB's interpolation capabilities to achieve this mapping effectively.

PREREQUISITES
  • MATLAB programming skills
  • Understanding of column vectors in MATLAB
  • Familiarity with MATLAB interpolation functions
  • Basic knowledge of mathematical functions and their implementation in MATLAB
NEXT STEPS
  • Explore MATLAB's 'interp1' function for one-dimensional interpolation
  • Learn about MATLAB's vectorization techniques for efficient calculations
  • Research how to create custom functions in MATLAB
  • Investigate the use of MATLAB's plotting functions to visualize the results of f(t)
USEFUL FOR

This discussion is beneficial for MATLAB users, particularly those involved in numerical analysis, data interpolation, and mathematical modeling, as well as engineers and scientists looking to implement custom functions based on vector data.

_zeQ
Messages
2
Reaction score
0
Hi everyone,

Lets say i have created a column vector c = [ N x 1 ] and my time vector has the same dimensions.

I want to create a function f(t) in which f(fstep) = c(cstep) where cstep is integer and fstep maybe not.
( for example f(0)=c(0), f(0.1)=c(1), ... f(10)=c(100))

As a result i will be able for example to do the calculation sin(t)*f(t).

Thanks
 
Physics news on Phys.org
I am attaching a document that can be useful (Chapter 1 and Chapter 2). Hope this helps, of course it would be helpful if I explain step by step what you intend to implement.
regards
 

Attachments

Last edited:

Similar threads

  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
4K