Answered

Strange behavior when initializing empty cell in struct()

If you want to define the property as empty, then you should use '[]' instead of '{}'. obj = struct(MyProp=123, MyOtherProp=[])...

Strange behavior when initializing empty cell in struct()

If you want to define the property as empty, then you should use '[]' instead of '{}'. obj = struct(MyProp=123, MyOtherProp=[])...

5 months ago | 1

Answered

I want to calculate the eigenvalues form the very huge sparse mass and stiffness matrix.

If eig() function is taking too long, you can use eigs() function. Example from mathworks eigs() site: A = delsq(numgrid('C',1...

I want to calculate the eigenvalues form the very huge sparse mass and stiffness matrix.

If eig() function is taking too long, you can use eigs() function. Example from mathworks eigs() site: A = delsq(numgrid('C',1...

5 months ago | 0

| accepted

Answered

How to nest and call the fmincon function in Simulink?

EDITED: to fix the initial_values to be a 3x3 matrix instead of lambda Your issue was in the line initial_values=[lambda(1,1)...

How to nest and call the fmincon function in Simulink?

EDITED: to fix the initial_values to be a 3x3 matrix instead of lambda Your issue was in the line initial_values=[lambda(1,1)...

5 months ago | 0

Answered

How to simulate code in symbolic form?

Here is one way, though it cannot solve it at one point I think so throws an error when asked to display the solution % assume ...

How to simulate code in symbolic form?

Here is one way, though it cannot solve it at one point I think so throws an error when asked to display the solution % assume ...

5 months ago | 0

Answered

delete zero in signal

Your question is a bit ambigious but if you just want to remove the 0 s from the signal you can use a switch and delay block to ...

delete zero in signal

Your question is a bit ambigious but if you just want to remove the 0 s from the signal you can use a switch and delay block to ...

5 months ago | 0

Answered

Unknown variables appearing in solutions for symbolic equation solver

This is shown in the documentation of solve, under Solve Polynomial Equations of High Degree. You should call the function wit...

Unknown variables appearing in solutions for symbolic equation solver

This is shown in the documentation of solve, under Solve Polynomial Equations of High Degree. You should call the function wit...

5 months ago | 0

Answered

What is MATLAB doing when adding multiple ZPK transfer functions together?

Yes but you are doing a fractional algebra. To refresh your memory: a/b + c/d = (a*d + c*b)/(b*d) Since numerator stays b*d, ...

What is MATLAB doing when adding multiple ZPK transfer functions together?

Yes but you are doing a fractional algebra. To refresh your memory: a/b + c/d = (a*d + c*b)/(b*d) Since numerator stays b*d, ...

5 months ago | 0

Answered

Want to programmatically get the Maltlab status of (ready, busy), etc., in the bottom left corner of the window. What procedure will be used?

I recommend you use waitbar() function as an indicator of the progress within the code. f = waitbar(0,'Program started...'); %...

Want to programmatically get the Maltlab status of (ready, busy), etc., in the bottom left corner of the window. What procedure will be used?

I recommend you use waitbar() function as an indicator of the progress within the code. f = waitbar(0,'Program started...'); %...

5 months ago | 0

Answered

How to save a output matrix in each iteration?

Here is one way, where M_total_P is a 2x2x901 matrix, where 901 is the number of frequencies you have in the code. clc clear ...

How to save a output matrix in each iteration?

Here is one way, where M_total_P is a 2x2x901 matrix, where 901 is the number of frequencies you have in the code. clc clear ...

5 months ago | 0

Answered

I am getting this warning "Matrix is singular to working precision." and my surf plot is not showing.

You are doing a matrix mutiplication when you call the u() function, since you call u function with matrix arguments X and Y. Th...

I am getting this warning "Matrix is singular to working precision." and my surf plot is not showing.

You are doing a matrix mutiplication when you call the u() function, since you call u function with matrix arguments X and Y. Th...

5 months ago | 1

Answered

Gain dimension failure ending in error

G gain is set for element wise multiplication instead of matrix multiplication, hence (1,4).*(4,1) = (4,4). x = ones(4,1); G =...

Gain dimension failure ending in error

G gain is set for element wise multiplication instead of matrix multiplication, hence (1,4).*(4,1) = (4,4). x = ones(4,1); G =...

5 months ago | 0

| accepted

Answered

change the color of curve from blue to any color and make it bold

x= 0:0.01:2*pi; y = sin(x); plot(x,y,'r') % r stands for red look at the documentation for different colors

change the color of curve from blue to any color and make it bold

x= 0:0.01:2*pi; y = sin(x); plot(x,y,'r') % r stands for red look at the documentation for different colors

5 months ago | 0

| accepted

Answered

Hi, why am I getting an error?

You provide a fitlm model to plot function and a color option. Remove the color option and try again. So change % plot(F_sept...

Hi, why am I getting an error?

You provide a fitlm model to plot function and a color option. Remove the color option and try again. So change % plot(F_sept...

5 months ago | 1

| accepted

Answered

Unrecognized function or variable 'del'.

Not recommended but you can generally overwrite native variable/function names. I cannot reproduce your problem n = 0; for del...

Unrecognized function or variable 'del'.

Not recommended but you can generally overwrite native variable/function names. I cannot reproduce your problem n = 0; for del...

5 months ago | 0

Answered

How to make the encircled curve by blue.

You have one weird data and script to visualize but here is one way clear all warning off % you had references to F:/ folder ...

How to make the encircled curve by blue.

You have one weird data and script to visualize but here is one way clear all warning off % you had references to F:/ folder ...

5 months ago | 0

| accepted

Answered

How to vary angles at constant rate in a kinematics problem?

For loops are easy to understand but as mentioned in comments, once you understand the logic you should vectorize it. The basic ...

How to vary angles at constant rate in a kinematics problem?

For loops are easy to understand but as mentioned in comments, once you understand the logic you should vectorize it. The basic ...

5 months ago | 0

| accepted

Answered

how to get the name of current running m script

mfilename() function seems to be what you are looking for.

how to get the name of current running m script

mfilename() function seems to be what you are looking for.

6 months ago | 0

| accepted

Solved

Mysterious digits operation (easy)

What is this digit operation? 0 -> 0 1 -> 9 121 -> 9 44 -> 6 15 -> 5 1243 -> 7 ...

6 months ago

Solved

Finding Perfect Squares

Given a vector of numbers, return true if one of the numbers is a square of one of the numbers. Otherwise return false. Example...

6 months ago

Solved

Maximum value in a matrix

Find the maximum value in the given matrix. For example, if A = [1 2 3; 4 7 8; 0 9 1]; then the answer is 9.

6 months ago

Answered

Class property validator reports an error if no default value is set

You can write your own validation function classdef MyClass properties hWriteFunc(1,1) {mustBeFunctionHandle} = @...

Class property validator reports an error if no default value is set

You can write your own validation function classdef MyClass properties hWriteFunc(1,1) {mustBeFunctionHandle} = @...

7 months ago | 2

Answered

contour diagram with three vectors

Here is one way: x = linspace(0,4,10); % x coordinate y = linspace(0,8,10); %^y coordinate [X,Y] = meshgrid(x,y); % meshgri...

contour diagram with three vectors

Here is one way: x = linspace(0,4,10); % x coordinate y = linspace(0,8,10); %^y coordinate [X,Y] = meshgrid(x,y); % meshgri...

7 months ago | 0

| accepted

Answered

Reset value of Ramp block to be used in Matlab Fctn block

Seems like this was a homework problem :D Take a look here:

Reset value of Ramp block to be used in Matlab Fctn block

Seems like this was a homework problem :D Take a look here:

7 months ago | 0

Answered

Ramp block having reset option

Here is one way with enabled subsystem, where the subsystem comes up with an offset (so if the ramp number gets too large it mig...

Ramp block having reset option

Here is one way with enabled subsystem, where the subsystem comes up with an offset (so if the ramp number gets too large it mig...

7 months ago | 0

Answered

Constant estimation from 2 noisy measurements

@Viktor Cockx, A bit late but here is an example for a mass spring damper system, where I am trying to estimate the mass, spring...

Constant estimation from 2 noisy measurements

@Viktor Cockx, A bit late but here is an example for a mass spring damper system, where I am trying to estimate the mass, spring...

7 months ago | 0

Solved

Project Euler: Problem 1, Multiples of 3 and 5

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23...

7 months ago

Answered

What does this section mean?

Probably the integral reset functionality. So when you disable and enable the controller, the integral term will reset to 0 to p...

What does this section mean?

Probably the integral reset functionality. So when you disable and enable the controller, the integral term will reset to 0 to p...

7 months ago | 3

| accepted

Answered

Creating a block for a term like (4s+1) in simulink?

I suggest you try to understand why 4*s+1 cannot be simulated. Although there are workarounds. hint: what does s do to a time do...

Creating a block for a term like (4s+1) in simulink?

I suggest you try to understand why 4*s+1 cannot be simulated. Although there are workarounds. hint: what does s do to a time do...

7 months ago | 0

| accepted

Answered

Find a value using an index obtained from a different matrix with same dimensions

Something like this maybe: %% your matrices val = load('Total_matrix_cases.txt'); x = load('Total_matrix_rotations.txt'); ...

Find a value using an index obtained from a different matrix with same dimensions

Something like this maybe: %% your matrices val = load('Total_matrix_cases.txt'); x = load('Total_matrix_rotations.txt'); ...

7 months ago | 1

| accepted