Community Profile

# Peter

### Automotive Industry

166 total contributions since 2011

View details...

Contributions in
View by

I need help with step function
Hi Anna, The (unit) step function is basically a function that goes from 0 to 1, generally at time 0, scaled by whatever magnit...

2 months ago | 0

Problems With Function Error
Up until recently, MATLAB had a requirement to separate scripts from functions. A file could hold one but not both types. Now, i...

2 months ago | 0

Assigning or replacing elements of another array into an array based on indices
Ali, I suggest you use logical indexing for this instead of FIND. It's faster and a little cleaner. Hope this helps! b = [0 ...

2 months ago | 0

Error using figure First argument must be a figure object or a positive Integer
Figure is a function. Try: figure(4) This should activate a figure with ID number 4.

2 months ago | 0

Run Simulink Model as a Function
Hi Sze, To clarify, you're hoping to run a simulink model from within a call to ODE45? While possible, I'm afraid this is goi...

2 months ago | 0

| accepted

find max value of structure
If I'm understanding correctly, you have a struct array, s, of size 1x30, with a single field (let's call it x). Something like...

3 months ago | 0

Solved

Word Counting and Indexing
You are given a list of strings, each being a list of words divided by spaces. Break the strings into words, then return a maste...

4 months ago

Solved

Test for balanced parentheses
Given the input inStr, give the boolean output out indicating whether all the parentheses are balanced. Examples: * If ...

4 months ago

Solved

Flip the vector from right to left
Flip the vector from right to left. Examples x=[1:5], then y=[5 4 3 2 1] x=[1 4 6], then y=[6 4 1]; Request not ...

4 months ago

Solved

Create a vector
Create a vector from 0 to n by intervals of 2.

4 months ago

Solved

Whether the input is vector?
Given the input x, return 1 if x is vector or else 0.

4 months ago

Solved

Find max
Find the maximum value of a given vector or matrix.

4 months ago

Solved

Doubling elements in a vector
Given the vector A, return B in which all numbers in A are doubling. So for: A = [ 1 5 8 ] then B = [ 1 1 5 ...

4 months ago

Derivative from ode45
Generally I send the result of ode45 back through my function as a post-processing step. [t,x] = ode45(@myDerivFcn,tspan,x0) ...

4 months ago | 0

How to solve two differential equations simultaneously with one having a matrix form of initial condition?
Hi Adham, Just to be clear, it's an ordinary differential equation, is /? If so, and each matrix term is separable, then you ...

4 months ago | 0

| accepted

Problem with xlim when having date
Hi Behzad, xlim sets the absolute max and min of the graph that you're looking at. To set the interval for grid lines, use the ...

4 months ago | 1

| accepted

Running ode45 from problem statement
Hi Daniel, For your problem, you were very close and had the solutions to each equation worked out correctly. The function sign...

4 months ago | 1

| accepted

You can't code an infinite sum exactly, but fortunately, this one is bounded (x^2 on the denominator and the numerator is bounde...

4 months ago | 0

Sort data based on different column
Try using the sortrows command in conjunction with a transpose. Apply it once to exploit column sorts (e.g. Column 1 is Row 1 ab...

4 months ago | 0

| accepted

Mimicking the font that title() uses when calling it with latex interpreter
Try using the Tex interpreter with the \bf switch? title('\bf\nabla TITLE','Interpreter','tex') seems to get the bold you're lo...

4 months ago | 0

Solved

Renaming a field in a structure array
MATLAB has a <http://www.mathworks.com/help/techdoc/ref/setfield.html setfield> and a <http://www.mathworks.com/help/techdoc/ref...

4 months ago

Solved

Get the length of a given vector
Given a vector x, the output y should equal the length of x.

5 months ago

Solved

Inner product of two vectors
Find the inner product of two vectors.

5 months ago

Solved

Arrange Vector in descending order
If x=[0,3,4,2,1] then y=[4,3,2,1,0]

5 months ago

Solved

Vector creation
Create a vector using square brackets going from 1 to the given value x in steps on 1. Hint: use increment.

5 months ago

How can I find correlation between two variables X & Y which I have obtained experimentally?
Three points will give you a line, but I'd be hesitant to call it a trend. In general, linear regression of X and Y gives you a ...

5 months ago | 1

Evaluating function handle with array input arguments
Are you specifically looking at a binomial expansion? If so, there's a trick for composing that. For a generalized "raise this ...

5 months ago | 1

Combine graphs from different script (directory)
Like you thought, the cleanest process is to write a 5th script which will do as you've written above. If the code is easily con...

5 months ago | 0

Running/testing scripts on multiple Matlab/Simulink versions?
MATLAB can run in a headless mode from the command line, where it can take a script to execute. It's been a while since I've don...

5 months ago | 0

| accepted