Answered
Filling in a polygon
Hi, it depends on the order you enter the single points. See this: x8=[0, 2, 2.5, 3.5, 5, 4, 5, 3, 1, 1.5]; y8=[2, 2, 0, 2...

7 years ago | 0

Answered
BVP4C code not giving an output & boundary condition issues.
Hi, your function does not return anything. Try: sol = main; subplot(2,1,1) plot(sol.x,sol.y) grid subplot(2,1,2) plot(so...

7 years ago | 0

Answered
None linear least square fit for complex model
Hi, have a read here: https://de.mathworks.com/help/releases/R2015a/curvefit/fit.html?searchHighlight=fit#bto2vuv-11 There is...

7 years ago | 0

Answered
Plot error, vector must be same length
Hi, make t same size then the vectors you want to plot: % h = 0.08; nmax = 800; wx = zeros(1, nmax); wy = wx; wz = wx; t...

7 years ago | 1

| accepted

Answered
Is't possible to plot a one curve with two Y-axises for this case
Hi, just scale them: A=[0.5778 40.0000 152.8081 0.5867 41.0000 154.7064 0.5956 42.0000 156.5817 0.6045...

7 years ago | 0

Answered
How do i fix this error?
Hi, the Display option is only avaiable if the fitting method is nonlinear least squares: https://de.mathworks.com/help/curvef...

7 years ago | 0

Answered
Unable to find explicit solution for "solve"
Hi, solve numeric: % Values for constants - I took some fantasy values... Isc = 0.1; Is = 1; q = 2; Rs = 0.0135; Rsh = -2...

7 years ago | 1

| accepted

Answered
how can i a create a struct?
Hi, the best way to learn Matlab is reading the excellent documentation. Have a read here: https://de.mathworks.com/help/matla...

7 years ago | 0

| accepted

Answered
Produce an excel file with major and minor column name
https://de.mathworks.com/matlabcentral/answers/337613-how-to-merge-cells-in-excel

7 years ago | 0

Answered
"the scope of variable spans multiple functions matlab"
Hi, yes, it is due to the nested functions. It is one possible way to avoid global variables. There is nothing wrong with it. T...

7 years ago | 4

| accepted

Answered
Average of two closed curves
Hi, try: % Calculate Parts to 90° angle1 = linspace(0,pi/4,180)'; % Radius of circle = length of square = 1 r = 1; % Calcu...

7 years ago | 3

Answered
Error when using ezplot
syms a(x,y) a = x^3 + y^3 - 3*x*y == 0; ezplot(lhs(a),[-2, 2, -3, 2])

7 years ago | 0

| accepted

Answered
Help me with indexing please?
Hi, as suggested in the comments read the documentation. Here is a small example which is near by your problem. Try to understa...

7 years ago | 0

| accepted

Answered
Finite Elements Method creating global stiffness matrix
Hi, you overwrite k every time. Im sure it could be done much easier - but here s a quick solution without any code optimizatio...

7 years ago | 6

| accepted

Answered
distance between two points
dist = sqrt((A(:,1)-B(:,1)).^2 + (A(:,2)-B(:,2)).^2 + (A(:,3)-B(:,3)).^2);

7 years ago | 0

| accepted

Answered
sound generation using MATLAB
Hi, think about your sampling frequency. Can it really work to sample a signal of 100kHz with a sample rate of 24kHz? Or do you...

7 years ago | 4

Answered
Importing .csv files and generating surf plots for each
Hi, have a read here: https://de.mathworks.com/help/matlab/ref/uigetfile.html#mw_8fd45c03-ae42-4f5a-9595-297c77185283 This ex...

7 years ago | 0

Answered
Resonance frequency in enclosures
Hi, you can use this function: function Frequencia_Table = Frequencia(v,lx,ly,lz) % Building the array of values nx = [zeros...

7 years ago | 1

| accepted

Answered
GWO structure help, please rewrite the code help
NumAgents = 7; maxiters = 2000; lb = [0 2]; ub = [1 5]; dim = 2; fobj = @my_function_that_expects_a_vector_of_2_values; ...

7 years ago | 0

Answered
Error using sym/subs Too many input arguments. Error in mx_model (line 176) f = subs(f, cup,cu,0);
Hi, as the error message says, there are too much input arguments. The correct syntax for subs is: subs(eqn,old,new) The code...

7 years ago | 0

| accepted

Answered
what does "X = X./max(max(X))" means?>
Hi, the dot means an elementwise operation. See here: https://de.mathworks.com/help/matlab/ref/rdivide.html For more informat...

7 years ago | 1

Answered
Extract all numbers from a matrix that also contains NaN into a single vector
A = [1 2 3; NaN -2 0; NaN 5 -8] result = A(~isnan(A)) gives. A = 1 2 3 NaN -2 0 NaN 5 -...

7 years ago | 0

| accepted

Answered
Finding unique values from arrays of different sizes
Hi, transpose them: A = [1; 2; 3]; B = [3; 4; 5]; C = [5; 6]; D = [8; 9]; % works_not = unique([A B C D]) works = unique(...

7 years ago | 0

| accepted

Answered
Error: Trust-region-dogleg algorithm of FSOLVE cannot handle non-square systems; using Levenberg-Marquardt algorithm instead.
Hi, add this line before you call fsolve: opts = optimoptions(@fsolve,'Algorithm', 'levenberg-marquardt'); Then in your call ...

7 years ago | 1

Answered
how to maximize the ratio between two areas
Hi, sorry for the late reply. I attached 2 files: Optm_Geo_new.m which is an adapted version of your original file and (if i m...

7 years ago | 0

| accepted

Answered
Efficient sparse matrix operation
Hi, if you precalculate the sum and then calculate you can save some time: N = sum(S,2); S./N; I tried using sparse matrices...

7 years ago | 0

Answered
matlab out of memory error when multiplying 2 matrix
Hi, consider: X = ones(3,120744); result_1 = X*X'; % --> Result = 3 x 3 Matrix (72 Byte) result_2 = X'*X; % --> Result = 1...

7 years ago | 1

| accepted

Answered
transfer fuction representation needed
Hi, this is a compact way to express 1 transfer function with 3 inputs and convert it to a state space representation.You can f...

7 years ago | 1

| accepted

Answered
HOW TO CREATE THİS MATRİX
Hi, beginning from R2016b you can use: A = [0:99] + [0:99]' or - with respect to Madhans comment for prior releases: B = bsx...

7 years ago | 0

Answered
Finding a maximum using gamultobj tool
Hi, all optimizers in Matlab try ti find minimum of functions. If you want to maximize you simply minimize the negative functio...

7 years ago | 0

| accepted

Load more