How to select a column with a specific value of interest and include it into equations.

1 view (last 30 days)
How can i write the equation below into matlab? Alpha is given and Vinfinity is also given. The part that i'm confused about is the si, si-1, thetai and thetai-1. I have a list of 100 values in a column and i want to write a code that selects a value that i will enter to be selected as si. Then whatever row in that column that value was it will minus the value in the previous row (this will be si-1). Same principle for the theta's. Please see below for the equation.

Answers (1)

Matt J
Matt J on 5 Nov 2020
f=@(t) sqrt(t-t.^2);
theta=acos(1-2*s);
G=alpha*Vinfinity*diff(theta+2*f(s));
  4 Comments
Matt J
Matt J on 7 Nov 2020
Edited: Matt J on 7 Nov 2020
Yes, s is meant to be a vector of length 100, or however many values you have. The result, G, will be a length-99 vector because there are ninety-nine differences . The expression,
f=@(t) sqrt(t-t.^2);
is an anonymous function. It is just a quick way of defining a short function. In hindsight, I could just as well have written,
theta=acos(1-2*s);
G=alpha*Vinfinity*diff(theta+2*sqrt(s-s.^2));

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!