research interests: vibrations, optimal control, system modeling and simulation, mechatronics... coding

Answered

Text File Read Matlab

Step 1. Data import from your txt file, e.g.: uiimport() Step 2. Save imported data Step 3. Compute the mean of the importe...

Text File Read Matlab

Step 1. Data import from your txt file, e.g.: uiimport() Step 2. Save imported data Step 3. Compute the mean of the importe...

1 month ago | 0

Answered

W-M function to plot 3d fractal surfaces

Hi, Here are corrected codes of yours. One more important note that it is not a good practice to call your m-file with a MATL...

W-M function to plot 3d fractal surfaces

Hi, Here are corrected codes of yours. One more important note that it is not a good practice to call your m-file with a MATL...

1 month ago | 2

Answered

Reading excel for for a particular date range and output the max corresponding value.

An easy solution is: sortrows()

Reading excel for for a particular date range and output the max corresponding value.

An easy solution is: sortrows()

1 month ago | 0

Answered

How can I make a sentence in Alphabetical order

Hi, Here is an easy solution to your exercise: CC='the quick brown fox'; ANS =sort(strsplit(strtrim(CC))) Good luck.

How can I make a sentence in Alphabetical order

Hi, Here is an easy solution to your exercise: CC='the quick brown fox'; ANS =sort(strsplit(strtrim(CC))) Good luck.

1 month ago | 0

Answered

How to find a number but if it repeats immediately after, take the first value.

Here is an easy solution to your exercise: A = [0 5 0 5 5 0 0 0 5 5 5 5 5 0 0 0]; IND = find(A==5); C = A(IND(1:5)); Good lu...

How to find a number but if it repeats immediately after, take the first value.

Here is an easy solution to your exercise: A = [0 5 0 5 5 0 0 0 5 5 5 5 5 0 0 0]; IND = find(A==5); C = A(IND(1:5)); Good lu...

1 month ago | 0

Answered

Plotting Isotherms on a contour plot

Here is a simple solution (plot part only) to your exercise: pcolor(rot90(rot90(x)), rot90(rot90(y)), T2), shading interp Good...

Plotting Isotherms on a contour plot

Here is a simple solution (plot part only) to your exercise: pcolor(rot90(rot90(x)), rot90(rot90(y)), T2), shading interp Good...

1 month ago | 0

Answered

Error with equation using sym/subsindex

In your code, there are a few confusions and flaws. You've define: f(A) = x.*tan(A)-(g./(2.*V.^2.*((cos(A)).^2))).* x.^2-y; f a...

Error with equation using sym/subsindex

In your code, there are a few confusions and flaws. You've define: f(A) = x.*tan(A)-(g./(2.*V.^2.*((cos(A)).^2))).* x.^2-y; f a...

1 month ago | 0

Answered

Error - "Simulink cannot propagate the variable-size mode"

Your MATLAB fcn blck file should have: function y = fcn(u) y = 0.02559*exp(u).*sin(2*u)-0.059734*exp(u).*cos(2*u);

Error - "Simulink cannot propagate the variable-size mode"

Your MATLAB fcn blck file should have: function y = fcn(u) y = 0.02559*exp(u).*sin(2*u)-0.059734*exp(u).*cos(2*u);

1 month ago | 0

Answered

Issue with plotting variables with ranges

Here is how to start this: N = 200; % Number of data points to be genearted and calculated to plot xc=linspace(0...

Issue with plotting variables with ranges

Here is how to start this: N = 200; % Number of data points to be genearted and calculated to plot xc=linspace(0...

1 month ago | 0

| accepted

Answered

Basic Sampling question involving sampling rate and graphing

Your code has a problem with the end time value to take into calculations and display of the calculated data points. Here are ...

Basic Sampling question involving sampling rate and graphing

Your code has a problem with the end time value to take into calculations and display of the calculated data points. Here are ...

1 month ago | 0

Answered

Shortest path constrained to use specific nodes

Here is an easy solution: shortestpath(G, 1,3) % Shortest path between 1 and 3 Good luck.

Shortest path constrained to use specific nodes

Here is an easy solution: shortestpath(G, 1,3) % Shortest path between 1 and 3 Good luck.

1 month ago | 0

Answered

Open the .dat file in Matlab

You can employ a few built in data import functions of MATLAB to read your data and then save them in *.mat file. E.g: FN = 'MY...

Open the .dat file in Matlab

You can employ a few built in data import functions of MATLAB to read your data and then save them in *.mat file. E.g: FN = 'MY...

1 month ago | 2

Answered

Using Diff() with NaN values

You can substitute all 'nan' values with 0's by locating them via isnan() and then substituting.

Using Diff() with NaN values

You can substitute all 'nan' values with 0's by locating them via isnan() and then substituting.

1 month ago | 0

Answered

How to feed additional variables into fsolve function

Here is a combined and a bit simplified solution: options = optimoptions('fsolve','Display','iter'); x0 = [150,0.045,7.5]; dv...

How to feed additional variables into fsolve function

Here is a combined and a bit simplified solution: options = optimoptions('fsolve','Display','iter'); x0 = [150,0.045,7.5]; dv...

1 month ago | 0

Answered

How would I solve for the two unknowns with 3 equations

Here is the simple solution: SOL = solve(mr*(hfgr + (.68*cpgr* (t2-t1)))==mw*(hfgw + (.68*cpgw *(T1-T2))), F*Ao*Uo*LMTD==mr*(hf...

How would I solve for the two unknowns with 3 equations

Here is the simple solution: SOL = solve(mr*(hfgr + (.68*cpgr* (t2-t1)))==mw*(hfgw + (.68*cpgw *(T1-T2))), F*Ao*Uo*LMTD==mr*(hf...

1 month ago | 0

| accepted

Answered

error too many input arguments

Here is the corrected one (more efficient in calculation part): kk=1:24000; xx0(kk)=exp(1i*kk*pi/16); N=20; for ii=1:N p...

error too many input arguments

Here is the corrected one (more efficient in calculation part): kk=1:24000; xx0(kk)=exp(1i*kk*pi/16); N=20; for ii=1:N p...

1 month ago | 0

Answered

Doubt in a product erro

Here is a small correction to obtain the correct answers in your exercise: t1 = 0:0.01:300; N = 2; % Number of ...

Doubt in a product erro

Here is a small correction to obtain the correct answers in your exercise: t1 = 0:0.01:300; N = 2; % Number of ...

1 month ago | 1

| accepted

Answered

Error in equation/variables

% You need to perform elementwise operation. Since Theta = [0, 120] Theta^2 % must be Theta.^2 . % missing before / o...

Error in equation/variables

% You need to perform elementwise operation. Since Theta = [0, 120] Theta^2 % must be Theta.^2 . % missing before / o...

1 month ago | 1

Answered

How to use trapz for area under curve

The answer to your exercise is realtively simple: IND = find(Ua2<=20); AREA = trapz(Ua2(IND), reva2(IND)); fprintf('The area ...

How to use trapz for area under curve

The answer to your exercise is realtively simple: IND = find(Ua2<=20); AREA = trapz(Ua2(IND), reva2(IND)); fprintf('The area ...

1 month ago | 1

| accepted

Answered

How to redirect function output arguments to a cell array

If this is the case, then you'd need to convert the outputs into cell array after acquiring the outputs from the function - sill...

How to redirect function output arguments to a cell array

If this is the case, then you'd need to convert the outputs into cell array after acquiring the outputs from the function - sill...

1 month ago | 0

Answered

Saving output of for loop after each iteration (for a function)

Here is the corrected code of yours: y = 0:0.05:1; u= 2*y-(2*y.^3)+y.^4; a = 0:0.01:1; b = 4000; C=zeros(numel(a),numel(u)...

Saving output of for loop after each iteration (for a function)

Here is the corrected code of yours: y = 0:0.05:1; u= 2*y-(2*y.^3)+y.^4; a = 0:0.01:1; b = 4000; C=zeros(numel(a),numel(u)...

1 month ago | 0

Answered

How to redirect function output arguments to a cell array

One of the easy and quick solution to your exercise is alike the following: OUT = sillyFunction(X); % The output is a cell arr...

How to redirect function output arguments to a cell array

One of the easy and quick solution to your exercise is alike the following: OUT = sillyFunction(X); % The output is a cell arr...

1 month ago | 0

Answered

How can analyse respones in MATLAB live screen?

With *.mlx editor, you can insert a slider to assign the magnitude value of y0, w1, w2, and set the value range of t. The rest i...

How can analyse respones in MATLAB live screen?

With *.mlx editor, you can insert a slider to assign the magnitude value of y0, w1, w2, and set the value range of t. The rest i...

1 month ago | 0

Answered

Subplot on a saved figure only working for one subplot

I presume that you have a loop before "if... end" operations, correct? You should put "hold all" command after your "plot()" co...

Subplot on a saved figure only working for one subplot

I presume that you have a loop before "if... end" operations, correct? You should put "hold all" command after your "plot()" co...

1 month ago | 0

Answered

convert Hexadecimal to decimal in text file

Use reshape(): reshape(DECd, 4, 6) % Because your converted data is 24 - by -1 Good luck

convert Hexadecimal to decimal in text file

Use reshape(): reshape(DECd, 4, 6) % Because your converted data is 24 - by -1 Good luck

1 month ago | 0

| accepted

Answered

Extract and Analyse data from multiple excel files and sheets

Please go over these hints given by mathworks staff for data import from MS Excel: http://www.mathworks.com/help/matlab/matlab...

Extract and Analyse data from multiple excel files and sheets

Please go over these hints given by mathworks staff for data import from MS Excel: http://www.mathworks.com/help/matlab/matlab...

1 month ago | 0

| accepted

Answered

Plot function y=(sin(x))/x for pi/100<=x<=10pi using increments of pi/100

% Start rightaway by defining the variable x and compute it x = pi/100:pi/100:10*pi; y = sin(x)./x; % plot plot(x, y) % Yo...

Plot function y=(sin(x))/x for pi/100<=x<=10pi using increments of pi/100

% Start rightaway by defining the variable x and compute it x = pi/100:pi/100:10*pi; y = sin(x)./x; % plot plot(x, y) % Yo...

1 month ago | 0

| accepted

Answered

Using ode45 to solve a Non linear ode with multiple variables?

Here is the corrected completed code: tic; tspan = 0:0.0033:100; a=55*(pi/180); b=0; k0 = [a; b]; [t,k] = ode45(@pend_k,...

Using ode45 to solve a Non linear ode with multiple variables?

Here is the corrected completed code: tic; tspan = 0:0.0033:100; a=55*(pi/180); b=0; k0 = [a; b]; [t,k] = ode45(@pend_k,...

1 month ago | 0

| accepted

Answered

solving BVP using anonymous function

Your four variables a, b, Ta and Tb are not defined. Pre-define their values just before your anonymous function is defined. ...

solving BVP using anonymous function

Your four variables a, b, Ta and Tb are not defined. Pre-define their values just before your anonymous function is defined. ...

1 month ago | 0

Answered

convert Hexadecimal to decimal in text file

Here is the one of the easy solutions: FN = 'HD.txt'; % File name % Open the data file to process: ID = fopen(FN); % Scan ...

convert Hexadecimal to decimal in text file

Here is the one of the easy solutions: FN = 'HD.txt'; % File name % Open the data file to process: ID = fopen(FN); % Scan ...

1 month ago | 0