1
vote
0answers
29 views

Matlab functions of variables

So I am writing a function to compute the following equations for an SIR model: So here's my code: ...
0
votes
1answer
35 views

Matlab using subscript variable

I'm trying to write a function in matlab but I don't quite know if it is working. In the equation line i have: xdot(2) = N_h * x; to signify: $$\frac{dy}{dt} = ...
0
votes
1answer
38 views

About a matlab mathematic problem from applied numerical method

Can you help me,please to solve this problem with the help of Matlab. Thanks!
0
votes
1answer
89 views

Matlab - Generate square convex function with positive definite Hessian Matrix

So, I have to generate a square convex function in Matlab and it's Hessian Matrix must be positive definite but I can't find any function that can help me do that. Is there anything I should search ...
0
votes
1answer
538 views

Computing a double integral using MATLAB

I need to compute a double integral using MATLAB I'm not good at programming. I believe you just have to use this function called integral2 http://www.mathworks.com/help/matlab/ref/integral2.html But ...
0
votes
1answer
48 views

Basic doubt matlab [closed]

Hi I want to evaluate a function in Matlab at some points, as an example: $for$ $i=-6\pi:\pi/10:6\pi$ $fun(j)=sin(i);$ Where I want to preallocate $fun$ like ...
0
votes
1answer
44 views

Define Matlab function depending from another function

I have a function $\phi(x,t)$ and I want to define a function $f$ whose values depend on $\phi$. Specifically: $$f(x,t) = \begin{cases}6\phi(x,t)+1, & \text{if }\phi(x,t) < 0 \\ 2\phi(x,t), ...
1
vote
0answers
127 views

Matlab (machine learning) - How to calculate binary scatter plot with straight line distinguishing these values?

Maybe title sounds a bit confusing, so I'll try to explain it. Let say we have a some matrix 4x4 = (0 0 0 1 0 0 0 1 1 0 0 0 0 0 1 0) So some function should ...
2
votes
1answer
296 views

Help with writing MATLAB code - Consider the function $f(x) = x \cos(-x^2)$

Would anyone be able to help me with this question? Consider the function: $f(x) = x \cos(-x^2)$ Write MATLAB functions f.m and fp.m for the function $f$ and its derivative $f '$, respectively.
1
vote
1answer
78 views

Nonlinear regression analysis of a vector

I'm trying to get a nonlinear fit of a vector in Matlab with no success. Let's assume that I have a vector called data: data = [1,30,250,55,22,76] which can be ...
0
votes
1answer
2k views

Calculation of bessel function versus matlab solution

I am looking to calculate the Bessel function of the first kind $J_o(\beta)$. I am using the formula (referenced from wikipedia) to accomplish this. $$J_\alpha (\beta) = ...
0
votes
1answer
2k views

Finding minimum/maximum of a multi-variable function under some constraints using matlab.

I have a function $f(x,y,z)$ I want to find the minimum/maximum of the function with some constraints like $$0 < x < C_1$$ $$0 < y+z <C_2$$ where $C_1$ and $C_2$ are some integer ...
1
vote
1answer
333 views

Produce piecewise monotonic function with 3 points and their slope with MATLAB

I'm trying to reproduce the shape of an airfoil's camber line using the leading edge angle, the trailing edge angle, the chord and the max camber value. I cannot use a spline because it overshoots ...
-1
votes
2answers
959 views

write text using an equation

Well like the batman equations and equations for heart, I once saw a site that draws equation for whatever text you type....but now I can't find it. Does anybody know such a site? Also a general ...
0
votes
1answer
2k views

Matlab: how to create a function $f(x)$ and get the value of $f(x)$ given $x$?

I'm a newbie to matlab and wonder how to create a function (i.e., $f(x) = 2*x+1$ ) get the value of $f(x)$ given $x$. In the above example, say $x=2$, I'd expect the result to be $5$ (yep, trivial ...
1
vote
1answer
2k views

How to create a function in matlab given the y values?

I was wondering if it is possible to create a function f(x) in matlab based on y values. Example X=[0,1,2,3,4,5,6,7,8,9] Y=[5,6,7,8,9,10,11,12,13,14] In this trivial example I wish to get f(x)=x+5 ...
0
votes
1answer
250 views

Matlab: Website with a lot of functions to download

I am looking for a website that contains a collection of functions, more than Matlab contains, to download I use from Matlab. The extension should be *.m or the code should appear. Thank you!