Answered

Help with contour plot

You actually do have 5 lines but they are on top of each other thats why you do not see them. So your Z matrix for k1(1) and k1(...

Help with contour plot

You actually do have 5 lines but they are on top of each other thats why you do not see them. So your Z matrix for k1(1) and k1(...

4 months ago | 0

| accepted

Answered

count number of elements for each slice of a vector

Here is one simple way: A = [2 1; 3 1; 4 2; 5 2; 6 2; 7 1; 8 1; 7 1; 5 2; 6 2]; ...

count number of elements for each slice of a vector

Here is one simple way: A = [2 1; 3 1; 4 2; 5 2; 6 2; 7 1; 8 1; 7 1; 5 2; 6 2]; ...

4 months ago | 0

| accepted

Answered

First cell in a string array is empty, how to replace this?

The issue is you are not initiating and filling the mode1_status matrix properly. Your initial mode1_status matrix is a 1x1 matr...

First cell in a string array is empty, how to replace this?

The issue is you are not initiating and filling the mode1_status matrix properly. Your initial mode1_status matrix is a 1x1 matr...

4 months ago | 0

| accepted

Answered

Which MATLAB license should I buy as a reseacher working in an NGO?

The best way to know is by contacting the sales directly, say it is a nonprofit NGO and for research. They might offer you eithe...

Which MATLAB license should I buy as a reseacher working in an NGO?

The best way to know is by contacting the sales directly, say it is a nonprofit NGO and for research. They might offer you eithe...

4 months ago | 2

Answered

Matlab optimization - variables to satisfy L1 norm

You create a nonlinear constraint functio and give it as an argument to the fmincon. [x,fval,exitflag,output]=fmincon(@(x)costF...

Matlab optimization - variables to satisfy L1 norm

You create a nonlinear constraint functio and give it as an argument to the fmincon. [x,fval,exitflag,output]=fmincon(@(x)costF...

4 months ago | 1

Answered

How to draw a Nyquist plot while avoiding the pole at the origin

I dont think the nyquist plots looks exactly like you draw by hand. You can set the axis limits to make the nyquist plot visib...

How to draw a Nyquist plot while avoiding the pole at the origin

I dont think the nyquist plots looks exactly like you draw by hand. You can set the axis limits to make the nyquist plot visib...

4 months ago | 0

Answered

How to draw a graph like the image attached below in MATLAB

You can also use countourf function; % random data from countour example x = linspace(-2*pi,2*pi); y = linspace(0,4*pi); [X,...

How to draw a graph like the image attached below in MATLAB

You can also use countourf function; % random data from countour example x = linspace(-2*pi,2*pi); y = linspace(0,4*pi); [X,...

4 months ago | 0

Answered

Insufficient number of input parameters.

The calculate_gain_sfunc requires an input. You called it without any inputs. calculate_gain_sfunc % WRONG way to run the func...

Insufficient number of input parameters.

The calculate_gain_sfunc requires an input. You called it without any inputs. calculate_gain_sfunc % WRONG way to run the func...

4 months ago | 0

Answered

Hi All. Just wondering why answer to (i) is not 4.9e+4. an why answer to (iii) is not (9x)/2 or 4.5 x. Many thanks. Brian

Your value in (i) for f(1.2) is 49020.80113638172, so when you round to 1 decimal, it becomes 49020.8 which in engineering notat...

Hi All. Just wondering why answer to (i) is not 4.9e+4. an why answer to (iii) is not (9x)/2 or 4.5 x. Many thanks. Brian

Your value in (i) for f(1.2) is 49020.80113638172, so when you round to 1 decimal, it becomes 49020.8 which in engineering notat...

4 months ago | 1

Answered

How can I express all the variables Vcm1, Vcm2, Vcm3, Vcm4 in num2str without getting an error?

Dont know what exactly you are trying to do but here is an example using your variable names: dim = [0.2 .5 0.25 0.1];% normali...

How can I express all the variables Vcm1, Vcm2, Vcm3, Vcm4 in num2str without getting an error?

Dont know what exactly you are trying to do but here is an example using your variable names: dim = [0.2 .5 0.25 0.1];% normali...

4 months ago | 0

| accepted

Answered

Intersection condition between two ellipses

Here is one way where accuracy will depend on selecting the threshold correctly. You simply solve the equation for y given an x ...

Intersection condition between two ellipses

Here is one way where accuracy will depend on selecting the threshold correctly. You simply solve the equation for y given an x ...

4 months ago | 0

Answered

Index exceeds the number of array elements. Index must not exceed 1

You are overwriting the C_Y array in your for loop. You initialize C_Y as a 5x5 zeros matrix and in the first iteration of your ...

Index exceeds the number of array elements. Index must not exceed 1

You are overwriting the C_Y array in your for loop. You initialize C_Y as a 5x5 zeros matrix and in the first iteration of your ...

4 months ago | 0

| accepted

Answered

help with nested loop and plot

Here is one simple dirty way: n= 101; x = linspace(-100, 100, n); y = linspace(-100, 100, n); [X, Y] = meshgrid(x, y); Z = ...

help with nested loop and plot

Here is one simple dirty way: n= 101; x = linspace(-100, 100, n); y = linspace(-100, 100, n); [X, Y] = meshgrid(x, y); Z = ...

4 months ago | 0

Answered

Accessing cell array entries using arrays

I think you want to use B columns as indeces to extract info from A, so: A=cell(2,2); B=[1 2 2 1 1; 2 1 2 1 2] A{1,1}=[4...

Accessing cell array entries using arrays

I think you want to use B columns as indeces to extract info from A, so: A=cell(2,2); B=[1 2 2 1 1; 2 1 2 1 2] A{1,1}=[4...

4 months ago | 0

Answered

what is the meaning of error "Index exceeds the number of array elements. Index must not exceed 8."

it means the size of y variable is 8 abd you are trying to get 9th 10th 11th index of the y vector. This is because your initial...

what is the meaning of error "Index exceeds the number of array elements. Index must not exceed 8."

it means the size of y variable is 8 abd you are trying to get 9th 10th 11th index of the y vector. This is because your initial...

4 months ago | 0

Answered

Someone help me to plot Ids vs Vds for HEMT AlGaN/GaN

I think what you are trying to do is vary Vds and see what Ids becomes. So here is a simple some modification for it using for l...

Someone help me to plot Ids vs Vds for HEMT AlGaN/GaN

I think what you are trying to do is vary Vds and see what Ids becomes. So here is a simple some modification for it using for l...

4 months ago | 0

Answered

Generating triangle wave form

You can use the general equation for the triangle wave and implement it using simple simulink blocks t = 0:0.01:10; % time f =...

Generating triangle wave form

You can use the general equation for the triangle wave and implement it using simple simulink blocks t = 0:0.01:10; % time f =...

4 months ago | 0

| accepted

Answered

How to use fminunc for a 2D function composed of two functions?

You dont seem to have a double function. So here is a code to solve your problem. You have local minimas so fmincon and brute f...

How to use fminunc for a 2D function composed of two functions?

You dont seem to have a double function. So here is a code to solve your problem. You have local minimas so fmincon and brute f...

4 months ago | 0

| accepted

Answered

the matrix addition should come 0 but it is not happening

Given the difference is 1e-12, it is probably floating point issue. Floating points list significant bit is generally unreliable...

the matrix addition should come 0 but it is not happening

Given the difference is 1e-12, it is probably floating point issue. Floating points list significant bit is generally unreliable...

4 months ago | 1

Answered

How can I make such that every method call to a class is routed through a wrapper

Any reason why you are not using wrapper_func with an input argument that determines which method it should call? With this you ...

How can I make such that every method call to a class is routed through a wrapper

Any reason why you are not using wrapper_func with an input argument that determines which method it should call? With this you ...

4 months ago | 0

| accepted

Answered

Can't stabilize system with PID

One thing you can do is use symbolic PID gains, plug them in your closed loop transfer function, and find the values via pole pl...

Can't stabilize system with PID

One thing you can do is use symbolic PID gains, plug them in your closed loop transfer function, and find the values via pole pl...

4 months ago | 0

| accepted

Answered

How to set upper x-axis ticks values and locations?

You were changing the label name at 30 60, instead of their actual values, so here is one dirty way but I recommend you follow t...

How to set upper x-axis ticks values and locations?

You were changing the label name at 30 60, instead of their actual values, so here is one dirty way but I recommend you follow t...

4 months ago | 0

| accepted

Answered

finding non zero solution for homogeneous system of equations

Since zeros(7,1) is kind of a solution for you, you should select your initial value away from that point. Below you can find a ...

finding non zero solution for homogeneous system of equations

Since zeros(7,1) is kind of a solution for you, you should select your initial value away from that point. Below you can find a ...

4 months ago | 1

Answered

Matlab plot is drawing an individual line to each data point

You have a lot of 0s in your nc and x vector, hence you go back and forth to 0 position. You can see this if you use a data poin...

Matlab plot is drawing an individual line to each data point

You have a lot of 0s in your nc and x vector, hence you go back and forth to 0 position. You can see this if you use a data poin...

4 months ago | 0

| accepted

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