Answered

Function to utilize user input on a GUI system?

If you want to ask such a question by a GUI dialog, you can use the function inputdlg. For instance: m = inputdlg('Please provi...

Function to utilize user input on a GUI system?

If you want to ask such a question by a GUI dialog, you can use the function inputdlg. For instance: m = inputdlg('Please provi...

4 months ago | 0

| accepted

Answered

generating random numbers only 2 numbers with percentage

The function rand generates random numbers uniformely distributed between 0 and 1. Hence, it is enough to set to 1 numbers the v...

generating random numbers only 2 numbers with percentage

The function rand generates random numbers uniformely distributed between 0 and 1. Hence, it is enough to set to 1 numbers the v...

4 months ago | 0

Answered

How do I create of a mesh of complete circle?

With Matlab PDE toolbox it is possible to define a circle and mesh it. You can do it by using the GUI, or by issuing the command...

How do I create of a mesh of complete circle?

With Matlab PDE toolbox it is possible to define a circle and mesh it. You can do it by using the GUI, or by issuing the command...

4 months ago | 0

Answered

How Can i solve this problem

Hi. The problem seems to be (among others) in your definition of t. Basically, t is empty; perhaps you wanted to write T-ts as u...

How Can i solve this problem

Hi. The problem seems to be (among others) in your definition of t. Basically, t is empty; perhaps you wanted to write T-ts as u...

4 months ago | 0

| accepted

Answered

ADD LATeX legends and labels in MATLAB figures

Hi. You must add 'interpreter', 'latex': figure plot(rand(20, 3), 'o-'); legend({'Mean Energy Consumption', 'Mean of $u_{i}$ ...

ADD LATeX legends and labels in MATLAB figures

Hi. You must add 'interpreter', 'latex': figure plot(rand(20, 3), 'o-'); legend({'Mean Energy Consumption', 'Mean of $u_{i}$ ...

4 months ago | 1

| accepted

Answered

3 dataset plot in single dimension plane

Method #2: use circles of different size to represent the value of c. I hope at least it will inspire you. c = [0.001 0.002 0.0...

3 dataset plot in single dimension plane

Method #2: use circles of different size to represent the value of c. I hope at least it will inspire you. c = [0.001 0.002 0.0...

4 months ago | 0

Answered

3 dataset plot in single dimension plane

Hi Suraj, you can use mesh, surf, contour and many others functions (see https://fr.mathworks.com/help/matlab/visualize/represen...

3 dataset plot in single dimension plane

Hi Suraj, you can use mesh, surf, contour and many others functions (see https://fr.mathworks.com/help/matlab/visualize/represen...

4 months ago | 0

Answered

Failure in initial objective function evaluation. in fgoalattain

Hi Li, the error is that funn requires three arguments, whereas fgoalattain needs a function with a single argument. To fix t...

Failure in initial objective function evaluation. in fgoalattain

Hi Li, the error is that funn requires three arguments, whereas fgoalattain needs a function with a single argument. To fix t...

4 months ago | 0

| accepted

Answered

How do I get rid of space above figure?

Hi Tobias, I had a similar problem (but I save images in .png format). I can propose the method I solved it: I save the image...

How do I get rid of space above figure?

Hi Tobias, I had a similar problem (but I save images in .png format). I can propose the method I solved it: I save the image...

4 months ago | 0

Answered

ODE solver vs discrete integration

Hi Stacy. Basically, you seem to be willing to solve your system of ODE by using the method of forward Euler. If so, there is ...

ODE solver vs discrete integration

Hi Stacy. Basically, you seem to be willing to solve your system of ODE by using the method of forward Euler. If so, there is ...

4 months ago | 1

| accepted

Answered

colour code plotted data according to column

Simply like that, if I correclty understand your question: % Generate some data p = linspace(0, 2*pi, 20000); data = zeros(nu...

colour code plotted data according to column

Simply like that, if I correclty understand your question: % Generate some data p = linspace(0, 2*pi, 20000); data = zeros(nu...

4 months ago | 1

Answered

I want to extract w and x from this code, but unfortunately i cant and it gives me only 1 answer.

Hi Alireza, I'm afraid that the fact your code returns only one value is the last of your problems. More specifically, you pro...

I want to extract w and x from this code, but unfortunately i cant and it gives me only 1 answer.

Hi Alireza, I'm afraid that the fact your code returns only one value is the last of your problems. More specifically, you pro...

4 months ago | 0

Answered

Plot the function combining an exponential function and a step function

Hi Nick, Your program seems correct. Perhaps you need to adapt the range over which the graphic is plotted (the default range i...

Plot the function combining an exponential function and a step function

Hi Nick, Your program seems correct. Perhaps you need to adapt the range over which the graphic is plotted (the default range i...

4 months ago | 0

| accepted

Answered

How to fix 'Index exceeds the number of array elements. Index must not exceed 1.'?

By a visual inspection of your code, one sees that at line 11 you assign to variables T1_old .. T3_old the value of T1(i) .. T3(...

How to fix 'Index exceeds the number of array elements. Index must not exceed 1.'?

By a visual inspection of your code, one sees that at line 11 you assign to variables T1_old .. T3_old the value of T1(i) .. T3(...

4 months ago | 0

Answered

Get index of an x, y data point via user selection in a plot.

I would do like that (thanks to KSSV, I didn't know functions scatter and knnsearch): function demo x = rand(10,1); y = r...

Get index of an x, y data point via user selection in a plot.

I would do like that (thanks to KSSV, I didn't know functions scatter and knnsearch): function demo x = rand(10,1); y = r...

4 months ago | 0

Answered

get the minimum and maximum element from two vectors.

Dear Shouze, as your question looks like an assignment I'll provide only some hints, but I will not write any code in your place...

get the minimum and maximum element from two vectors.

Dear Shouze, as your question looks like an assignment I'll provide only some hints, but I will not write any code in your place...

4 months ago | 1

Answered

Derivating a variable with respect to other vars

In my opinion, you can do it analytically: syms Umin a1 tau = sqrt( (2*Umin-Umin^3+Umin^4+2*Umin^2-8) / (2*a1*Umin^3*(Umin^2+4...

Derivating a variable with respect to other vars

In my opinion, you can do it analytically: syms Umin a1 tau = sqrt( (2*Umin-Umin^3+Umin^4+2*Umin^2-8) / (2*a1*Umin^3*(Umin^2+4...

4 months ago | 0

Answered

Numerical Integration on Matlab

Hi. I would say no: you forget to multiply I2 and J2 by the respective constants I2_c and J2_c. That being said, these function...

Numerical Integration on Matlab

Hi. I would say no: you forget to multiply I2 and J2 by the respective constants I2_c and J2_c. That being said, these function...

4 months ago | 0

Answered

I'm not sure how to relate a counter

Hi Saskiaa, if the question is just "how to have j = 1, 2, 3 ... when n = 0, 1, 2 ..." it is enough to write the loop with respe...

I'm not sure how to relate a counter

Hi Saskiaa, if the question is just "how to have j = 1, 2, 3 ... when n = 0, 1, 2 ..." it is enough to write the loop with respe...

4 months ago | 1

Answered

Subtraction between a matrix and a column vector

Hi. If the matrix and the vector have compatible size (= like you mentioned), it is enough to use the minus operator: A = rand(...

Subtraction between a matrix and a column vector

Hi. If the matrix and the vector have compatible size (= like you mentioned), it is enough to use the minus operator: A = rand(...

4 months ago | 1

| accepted

Answered

Summation of certain range of entries/numbers from a large array

Hi Raashid, if you know the range over which you need to compute the sum, it is enough to do like that: A = rand(2807, 1); p...

Summation of certain range of entries/numbers from a large array

Hi Raashid, if you know the range over which you need to compute the sum, it is enough to do like that: A = rand(2807, 1); p...

4 months ago | 0

| accepted

Answered

I want my function to return -1 when the file doesn't open.

Hi. You must return just after assigning the value -1 to charnum. If you call the function error... well, you get an error messa...

I want my function to return -1 when the file doesn't open.

Hi. You must return just after assigning the value -1 to charnum. If you call the function error... well, you get an error messa...

4 months ago | 1

Answered

Parallelization of SVD on research clusters

Hi Kamil, perhaps this answer will help you: https://fr.mathworks.com/matlabcentral/answers/247506-undefined-function-svd-for-d...

Parallelization of SVD on research clusters

Hi Kamil, perhaps this answer will help you: https://fr.mathworks.com/matlabcentral/answers/247506-undefined-function-svd-for-d...

4 months ago | 0

Answered

Steepest Descent Method with Stopping Criteria using MATLAB

Hi. I don't know it steepest descend is part of any of the Matlab toolbox (anyway, you can find a version here: https://fr.mathw...

Steepest Descent Method with Stopping Criteria using MATLAB

Hi. I don't know it steepest descend is part of any of the Matlab toolbox (anyway, you can find a version here: https://fr.mathw...

4 months ago | 0

| accepted

Answered

Curve in matlab plotting

Dear Amy, if I understand correctly your question, you can use semilogy instead of plot: data = [ ... 57 78.2 165.1 ; ...

Curve in matlab plotting

Dear Amy, if I understand correctly your question, you can use semilogy instead of plot: data = [ ... 57 78.2 165.1 ; ...

4 months ago | 0

Answered

How would I write a function that finds the closest point from a list of coordinates?

Hi Joshua, you can try this: x = [3, 1, 2, 2]; y = [5, 2, 4, 6]; current_site = 4; site_list = [1, 3]; [chosen_site, d] = s...

How would I write a function that finds the closest point from a list of coordinates?

Hi Joshua, you can try this: x = [3, 1, 2, 2]; y = [5, 2, 4, 6]; current_site = 4; site_list = [1, 3]; [chosen_site, d] = s...

4 months ago | 0

| accepted

Answered

How can I use feval, linespace and int()?

You can do like that: syms x; ex = int(x^2); s = @(x) subs(ex, 'x', x); numPoints = 200; xvec = linspace(1,10,numPoints);...

How can I use feval, linespace and int()?

You can do like that: syms x; ex = int(x^2); s = @(x) subs(ex, 'x', x); numPoints = 200; xvec = linspace(1,10,numPoints);...

4 months ago | 0

| accepted

Answered

how to use for loop in equation

Hi Shiv, up to my understanding you want to execute a kind of parametric study, basing on a parameter A (and perhaps in future...

how to use for loop in equation

Hi Shiv, up to my understanding you want to execute a kind of parametric study, basing on a parameter A (and perhaps in future...

4 months ago | 0

Answered

Why the solution is higher than the initial conditions in a model without heatsource?

Dear YL, In my opinion which is observed in the figure is just a uniform temperature T = 50, plus a numerical noise, which may...

Why the solution is higher than the initial conditions in a model without heatsource?

Dear YL, In my opinion which is observed in the figure is just a uniform temperature T = 50, plus a numerical noise, which may...

4 months ago | 0

| accepted

Answered

How to solve trigonometric equation x*cos(x)+sin(x)=0 with function fsolve?

Hi Attho, since your function depends on one varialbe only, you can solve more easily with fzero: fun = @(x) x.*cos(x)+sin(x)...

How to solve trigonometric equation x*cos(x)+sin(x)=0 with function fsolve?

Hi Attho, since your function depends on one varialbe only, you can solve more easily with fzero: fun = @(x) x.*cos(x)+sin(x)...

4 months ago | 1

| accepted