All

RANK**273**

REPUTATION**244**

CONTRIBUTIONS

**0** Questions

**140** Answers

ANSWER ACCEPTANCE **
0.00%
**

VOTES RECEIVED**22**

CONTRIBUTIONS**0 Posts**

CONTRIBUTIONS**0** Public Channels

AVERAGE RATING

CONTRIBUTIONS**0** Highlights

AVERAGE NO. OF LIKES

Answered

Add a diagonal of zeros to a matrix in MATLAB

You can use a loop like this: M1 = [ 1 2 3 4 2 5 4 2 3 4 5 1 4 2 1 2 ]; N=size(M1,1); M2=ze...

Add a diagonal of zeros to a matrix in MATLAB

You can use a loop like this: M1 = [ 1 2 3 4 2 5 4 2 3 4 5 1 4 2 1 2 ]; N=size(M1,1); M2=ze...

6 months ago | 2

| accepted

Answered

why my Matlab calculate a simple code so solw?

When you use this command: two = 1 + 1 The program should display the results and it takes time to transfer data to graphic ca...

why my Matlab calculate a simple code so solw?

When you use this command: two = 1 + 1 The program should display the results and it takes time to transfer data to graphic ca...

6 months ago | 0

Answered

vector input to wrldmagm

The function only accepts scalar values not vectors. You may use a loop to extract the magnetic field for every element of your ...

vector input to wrldmagm

The function only accepts scalar values not vectors. You may use a loop to extract the magnetic field for every element of your ...

6 months ago | 0

| accepted

Answered

Renaming output files so as not to overwrite when name is duplicated

You can use some code like this: filename = '202004'; n=0; if ~isempty(dir(filename)) for n=1:1000 newFile = fp...

Renaming output files so as not to overwrite when name is duplicated

You can use some code like this: filename = '202004'; n=0; if ~isempty(dir(filename)) for n=1:1000 newFile = fp...

6 months ago | 0

Answered

Newton Raphson Method in a for loop

Newton method is originally for root finding. If you want to use it for optimization, the derivative of the function should be z...

Newton Raphson Method in a for loop

Newton method is originally for root finding. If you want to use it for optimization, the derivative of the function should be z...

6 months ago | 0

Answered

Generate a general Matlab code

There are3 steps: 1- Shifting the (x0, y0) to the origin 2- Rotation about the new origin 3- Shifting back to the actual aori...

Generate a general Matlab code

There are3 steps: 1- Shifting the (x0, y0) to the origin 2- Rotation about the new origin 3- Shifting back to the actual aori...

6 months ago | 0

Answered

"Error using plot, Value not a numeric scalar"

it should be y1(i), y2(i). or y3(i)

"Error using plot, Value not a numeric scalar"

it should be y1(i), y2(i). or y3(i)

6 months ago | 0

Answered

Plot a vector field from a matrix

You can use a scale like this: N=100; theta=2*pi*rand(N,N); % random for this example only [X,Y]=meshgrid(1:N,1:N); U=cos(...

Plot a vector field from a matrix

You can use a scale like this: N=100; theta=2*pi*rand(N,N); % random for this example only [X,Y]=meshgrid(1:N,1:N); U=cos(...

6 months ago | 0

| accepted

Answered

How can I modify this code so it gives the value 0 for c. It should only provide ax^2+bx

%x=[0 .5 1 1.5 2 2.5 3 3.5 4 4.5 5]; %y=[0 -5.27 -8.10 -8.46 -6.38 -1.84 5.15 14.59 26.48 40.83 57.63]; function [coefficients...

How can I modify this code so it gives the value 0 for c. It should only provide ax^2+bx

%x=[0 .5 1 1.5 2 2.5 3 3.5 4 4.5 5]; %y=[0 -5.27 -8.10 -8.46 -6.38 -1.84 5.15 14.59 26.48 40.83 57.63]; function [coefficients...

7 months ago | 1

Answered

Determining if the columns of a matrix are orthogonal

Regarding the case i==j, you can start j from numbers greather than i: A = magic(4) orth = 1; for i = 1:n for j = i+1:n...

Determining if the columns of a matrix are orthogonal

Regarding the case i==j, you can start j from numbers greather than i: A = magic(4) orth = 1; for i = 1:n for j = i+1:n...

7 months ago | 0

Answered

How to convert number to string with fixed length?

You can use sprintf s=sprintf('%05d',124); disp(s); %05d means that you have leading zeros and the total length 0f 5

How to convert number to string with fixed length?

You can use sprintf s=sprintf('%05d',124); disp(s); %05d means that you have leading zeros and the total length 0f 5

7 months ago | 0

| accepted

Answered

Find angle of rotation matrix in MATLAB

I = [11755 0 4821; 0 15000 0; 4821 0 23245]; Iwant = [10000 0 0; 0 15000 0; 0 0 25000]; t = 0; i=1; tList = 0:.02:3.14; dLi...

Find angle of rotation matrix in MATLAB

I = [11755 0 4821; 0 15000 0; 4821 0 23245]; Iwant = [10000 0 0; 0 15000 0; 0 0 25000]; t = 0; i=1; tList = 0:.02:3.14; dLi...

7 months ago | 0

Answered

Why do I keep getting this error message? Error using ./ Matrix dimensions must agree.

if you want to solve the equations, use this: x=A\y;

Why do I keep getting this error message? Error using ./ Matrix dimensions must agree.

if you want to solve the equations, use this: x=A\y;

7 months ago | 0

Answered

what is the function used to give parabolic load on the free end of the cantilever beam

The q value (shear stress) is equal to Then you need to inegrate from for example -3 to 3 , 3 to 9 to find P value

what is the function used to give parabolic load on the free end of the cantilever beam

The q value (shear stress) is equal to Then you need to inegrate from for example -3 to 3 , 3 to 9 to find P value

8 months ago | 0

| accepted

Answered

Three exponential fit with curve fitting toolbox

In the toolbox, there is an option to define a custom model. https://www.mathworks.com/help/curvefit/custom-nonlinear-models.ht...

Three exponential fit with curve fitting toolbox

In the toolbox, there is an option to define a custom model. https://www.mathworks.com/help/curvefit/custom-nonlinear-models.ht...

8 months ago | 0

Answered

Error using fprintf Invalid file identifier. Use fopen to generate a valid file identifier. Function help

Because E is a numeric variable, it conot be used directly in your case. Use E with some formatting: fprintf('%g\n',E)

Error using fprintf Invalid file identifier. Use fopen to generate a valid file identifier. Function help

Because E is a numeric variable, it conot be used directly in your case. Use E with some formatting: fprintf('%g\n',E)

8 months ago | 0

Answered

How do I write a number and Letter in the same line?

You can use: fprintf('grade=%f, %s\n',n, grade);

How do I write a number and Letter in the same line?

You can use: fprintf('grade=%f, %s\n',n, grade);

8 months ago | 0

| accepted

Answered

finite element method with matrix error

Can you show the values of the nodes and elements data?

finite element method with matrix error

Can you show the values of the nodes and elements data?

8 months ago | 0

Answered

Seeking a little clarification on using sprintf with %d and formatSpec etc. to load similar *.MAT filenames that only differ in name by number.

you can use: sprintf('Band%dHz.mat', k*200);

Seeking a little clarification on using sprintf with %d and formatSpec etc. to load similar *.MAT filenames that only differ in name by number.

you can use: sprintf('Band%dHz.mat', k*200);

8 months ago | 0

Answered

"SWITCH expression must be a scalar or a character vector".

Try to get 'Value' in the call back function: handles.patient = get(hObject,'Value');

"SWITCH expression must be a scalar or a character vector".

Try to get 'Value' in the call back function: handles.patient = get(hObject,'Value');

8 months ago | 0

Answered

How can I make a variant submatrix?

You can use vectors to point to the indices of matrix A, For example: A(1:10, 1:10); % the first one A(11:20, 1:10) % second ...

How can I make a variant submatrix?

You can use vectors to point to the indices of matrix A, For example: A(1:10, 1:10); % the first one A(11:20, 1:10) % second ...

8 months ago | 0

Answered

Saving Multiples Variable of a function

If you want to use the variables in the other function, use this command in both functions: global dZ3 dW3 db3 dZ2 dW2 db2 dZ1 ...

Saving Multiples Variable of a function

If you want to use the variables in the other function, use this command in both functions: global dZ3 dW3 db3 dZ2 dW2 db2 dZ1 ...

8 months ago | 0

| accepted

Answered

how do I start this?

As the quest said, you can use Matlab's spline function.

how do I start this?

As the quest said, you can use Matlab's spline function.

8 months ago | 0

Answered

2-D Truss Analysis

One t was missing in UniVctor: %.... Input problem data nNodesP = 12; nMembersP = 21; NodeP = zeros(nNodesP, 3); %Initializ...

2-D Truss Analysis

One t was missing in UniVctor: %.... Input problem data nNodesP = 12; nMembersP = 21; NodeP = zeros(nNodesP, 3); %Initializ...

8 months ago | 0

Answered

Bisection method help.

function x = Bisection(a, b, Nmax, TOL) f=@(x) x.*x.*x-2; i=1; ya = f(a); while i <= Nmax m=(a+b)/2; ym=f(m); ...

Bisection method help.

function x = Bisection(a, b, Nmax, TOL) f=@(x) x.*x.*x-2; i=1; ya = f(a); while i <= Nmax m=(a+b)/2; ym=f(m); ...

8 months ago | 0

Answered

Converting for loop to while loop

for i =1:5 j=1; k=1; while j<=5-i fprintf(' '); j = j+1; end while k<=i fpri...

Converting for loop to while loop

for i =1:5 j=1; k=1; while j<=5-i fprintf(' '); j = j+1; end while k<=i fpri...

8 months ago | 1

| accepted

Answered

How to draw a curly brace outside the gca?

Use negative ccordinates for the brace byt xlim from 0 drawbrace([-0.5,3], [-0.5,8], 10); xlim([0,Inf]);

How to draw a curly brace outside the gca?

Use negative ccordinates for the brace byt xlim from 0 drawbrace([-0.5,3], [-0.5,8], 10); xlim([0,Inf]);

8 months ago | 0

Answered

A recursive matrix sum

You function is not recursive function total=ff(l) lp=l(:); if numel(l) == 1 total = l(1); else total = lp(end) + ...

A recursive matrix sum

You function is not recursive function total=ff(l) lp=l(:); if numel(l) == 1 total = l(1); else total = lp(end) + ...

8 months ago | 0

| accepted

Answered

Adding a line to my plot3 of a plane

Two lines should be fixed: 1- coordinates of end points of the line 2- Using plot3 %Position vector p1 = [200; -107; 0] %%or...

Adding a line to my plot3 of a plane

Two lines should be fixed: 1- coordinates of end points of the line 2- Using plot3 %Position vector p1 = [200; -107; 0] %%or...

8 months ago | 0