Community Profile

# Karim

Last seen: Today Active since 2016

Mechanical Engineer

Programming Languages:
MATLAB
Spoken Languages:
English
Professional Interests:
Optimization, Multibody Modeling, Finite Element Analysis (FEA)

All

#### Content Feed

View by

How to find X and Y coordinates of maximum gap between curves?
It depends on what you mean with the gap, notice that you plot it on a logarithmic axis. As a result from a graphical point of v...

alrededor de 4 horas ago | 1

i need the curve of this fourier series
see below for a demo on how to set this up % set up the x values x = linspace(-3*pi, 3*pi, 1e3); % assume 10 terms for the ...

1 día ago | 0

Match numbers to allocate text
you can use the categorical command to do this: y = [12 13 19 24 21 12 12]'; B = categorical( y, [12 13 19 21], ["A" "B" "C"...

2 días ago | 0

| accepted

How to build a 3d map from raw data?
If you want to plot the curves in 3D, you can use the plot3 command. See below for an example: % read the data opts = spreadsh...

2 días ago | 0

change the scale of colorbar
you can use the caxis command, simply add caxis( [0 0.02]) below the colorbar command. figure surf(rand(10,10)) c = colorbar;...

2 días ago | 0

What is the syntax for iterating over given coordinates, using a For loop?
You can do this in the following way: X1 = [10 12 14 23 24 23 18 16 12 10]; Y1 = [20 20 18 15 8 7 8 6 12 20]; for i = 1:num...

8 días ago | 0

| accepted

How to convert strings in a table to numbers?
An easy method would be to use the third output of the unique command. This will work directly on strings and will give the core...

8 días ago | 1

Extract value from every struct
You can acces the data in the struct by placing a point after the variable name of the struct, follewed by the fieldname you wan...

8 días ago | 0

text file to be in the folder
No need for the save command, first create the folder (or check that it exists) and then you can write the file directly into th...

27 días ago | 0

How to create a triangular shape using following Code in MATLAB
Based on the scatter mentioned in you question I combined the two loops and the resulting points in a single grid. This allows t...

28 días ago | 0

Running my code in a loop to make it more efficient
You can create a for loop, and just save the variables directly into matrices, see below for an example with 10 iterations and 7...

29 días ago | 0

| accepted

Count impulses into sequence of impulses and segments of sequences of impulses from signal
If the rectangles were drawn using matlab, then you know the start and stop time. Thus, if this works for the total number of p...

29 días ago | 0

Rewrite the format of a string
In the for loop, 'x' starts from 1, hence you will overwrite the data in iwant for each new file. One method to resolve this is...

29 días ago | 0

how to draw Bipartite Matrices and Projection Matrices.
such figures can be generated with the spy command. See below for an attempt to produce the top left figure using a bit of rando...

alrededor de 1 mes ago | 0

| accepted

Array indices must be positive integers or logical values.
The following part of you code can produce an error: i starts at 1, hence you are trying to acces t(0) which is not possible. In...

alrededor de 1 mes ago | 1

Average of multiple matrices
This depends how your images are stored in memory, if they are stored in a 3D array you can use the mean function % generate 3...

alrededor de 1 mes ago | 0

| accepted

Vector question help?
% this step creates a vector with 25 normal distributed random values MyVector = randn( 1,25 ) % if you want to round these va...

alrededor de 1 mes ago | 0

Plot an equation in time span T=[0,t]
You need to create a vector, below you can see a method using the "linspace" function. This creates a vector between 0 and t wit...

alrededor de 1 mes ago | 0

| accepted

how to create random vector?
RandomDouble = rand(25,1) % i.e. pick 25 random values between 0 and 1 RandomIntegers = randi(1000,25,1) % i.e. pick 25 integer...

alrededor de 1 mes ago | 0

| accepted

If else -statement doesn't work
The easiest method will be to first create a zero array, and then fill in the values according to the required logic: % intiali...

alrededor de 1 mes ago | 1

calculate the volume obtained by rotating a function around the X-axis
Hello, since at first glance there are no internal voids you can use the convex hull function to determine the volume numericall...

alrededor de 1 mes ago | 1

| accepted

To concatenate single column of a cell array
You can use cell2mat to do this, see below for an example % generate cell array with random data C = cell( 3072 , 2); C = cel...

alrededor de 1 mes ago | 0

| accepted

How to use Matlab to solve equation like Mathcad
Use the symboic toolbox to determine the equations, see below. syms fp1 fp2 fz1 fz2 fc boost real eqn = boost == ( atan(fc/fz1...

alrededor de 1 mes ago | 0

| accepted

Error in writing the output to excel file
As indicated in the error message you need to convert the sym into a double or a string, see below for both options syms m1 m2 ...

alrededor de 1 mes ago | 0

| accepted

Trying to find the corresponding value of a matrix with an input?
see below for the interpolation fig = openfig('VelocityAgainstRodHeight500Hz.fig'); axObjs = fig.Children; dataObjs = axObjs....

alrededor de 1 mes ago | 1

| accepted

How introduce a delay of one second in MATLAB?
you can use the "pause" function, this will pause matlab for the given amount of time pause(1)

alrededor de 1 mes ago | 0

| accepted

create a sparse multidimensional matrix
you can either fill it in directly or use blkdiag to create this shape: % direct method % on row 3 7 and 11, column 1 2 3 resp...

alrededor de 1 mes ago | 0

How to define if a point is inside or outside a 3D pyramidal area?
Hi, asuming you want to use as many standard matlab functions, the easiest method i can think is by constructing two terahedrond...

alrededor de 1 mes ago | 1