Beantwortet
Why is my code not working?
Run [fList, pList] = matlab.codetools.requiredFilesAndProducts('untitled8.m') pList.Name pList.Version pList.ProductNumber ...

mehr als 3 Jahre vor | 0

Beantwortet
Assembling Global Stiffness Matrix
This is analogous to your 2x2 code. I don't know if it's the right way to code M. k1=rand(4); k2=rand(4); k3=rand(4); C = ...

mehr als 3 Jahre vor | 0

Beantwortet
question regarding sum(m,3) command
It is summed over the third dimension of the matrix. A = zeros(2,2,2); A(:,:,1) = [1 2;3 4]; A(:,:,2) = [5 6;7 8]; sum(A,3) ...

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
Optimize a variable which is dependent on other variables
theta = 1:20; l = 5; obj = @(x) x(1); x0 = rand(1,numel(theta)+1); sol = fmincon(obj,x0,[],[],[],[],zeros(1,numel(theta)+1),...

mehr als 3 Jahre vor | 1

| akzeptiert

Beantwortet
Getting multiple outputs in one time
A = arrayfun(@(k)stiff(k),1:20,'UniformOutput',0) function out = stiff(k) out = k*[1 2 3;4 5 6]; end

mehr als 3 Jahre vor | 0

Beantwortet
how can i use simulated annealing for calculating the regression coefficients?
It's not simulated annealing, but most probably much faster. M = [3979278.479 654200.79 35.38 -27.86 4196516.825 554782.87...

mehr als 3 Jahre vor | 0

Beantwortet
pointwise multiplication of sparse matrix with full array
rand(2,2,2,2) generates a (2x2x2x2) array for B. You cannot multiply A with such a B elementwise because the array sizes don't m...

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
Generating random circles/ellipses inside circular domain
Maybe you could generate the circles/ellipses in a square domain with side length R (the radius of your circular shape) and fina...

mehr als 3 Jahre vor | 0

Beantwortet
A positive root of an equation
Without further knowledge about the background of your question: Maybe by setting (r(M)(a+P(M))(K-d))/(bK) instead of M in your...

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
Convex quadratic problem on two variables
fminimax. min_d max_j (g_j^t*d + 0.5*d^t*B_j*d) And the solution variables have to be put in one vector x that can comprise as...

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
Finding roots of a two variable function
x = rand(10,1); fun = @(z)BirnbaumSaunders(z(1),z(2),x); z = fsolve(fun,[0.65,2.13]) norm(fun(z)) function f = BirnbaumSau...

mehr als 3 Jahre vor | 0

Beantwortet
Data Analysis - Matlab Code
D = randi([-5, 5],4,2) Cn = eye(size(D,1))-1/size(D,1)*ones(size(D,1)) D_centered = Cn*D mean(D_centered,1)

mehr als 3 Jahre vor | 1

| akzeptiert

Beantwortet
How to find x value for a known Y in array?
x = 0.1:0.1:4*pi-0.1; y = sin(x); i = find(y(1:end-1).*y(2:end) <= 0) x_root = x(i)-y(i).*(x(i+1)-x(i))./(y(i+1)-y(i)) [pi,2...

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
How do I convert a cell array with multiple values per cell into a numerical array with multiple rows?
n = 13; C = cell(1,n); for i=1:n C{i} = rand(5,1); end A = cell2mat(C) class(A)

mehr als 3 Jahre vor | 1

Beantwortet
Hello everybody. I need your help. I need to display an image (.jpg) and would like it to close after 5 seconds. How could I do?
https://de.mathworks.com/matlabcentral/answers/1614610-how-to-display-any-image-for-500-ms

mehr als 3 Jahre vor | 0

Beantwortet
How can I add two curves that don't share the same x-axis values?
T = union(t1,t2); Y1 = interp1(t1,y1,T,[],'extrap'); Y2 = interp1(t2,y2,T,[],'extrap'); diffY = Y1-Y2 plot(T,diffY)

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
using x vector input to find corresponding y value
Three possible solutions: x = [-2:0.5:16.5]; y = findingy1(x); figure(1) plot(x,y) y = findingy2(x); figure(2) plot(x,y) ...

mehr als 3 Jahre vor | 0

Beantwortet
Find the rows have two same elements from a matrix
A = [1 9 8 2 7 8 5 8 9 6 5 4 7 3 8 5 4 8]; [I,J] = meshgrid(1:size(A,1),1:size(A,1)); [rows cols...

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
Why am I getting inf even though there is no divide by zero?
while 1 Pi_sat=A-B./(to+C) alpha=Pi_sat/Pi_sat(k) ... instead of while 1 for i=1:n ...

mehr als 3 Jahre vor | 0

Beantwortet
Issue defending a variable in MATLAB APP Desinger
If fs is a vector of values, you have to use elementwise division: 1./fs instead of 1/fs Same for m_k = app.amp.*cos(2*pi*...

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
I want to multiply a vector by a number and calculate the sum of all the values.
A = [18;15;125;48;78;69;48;15;12;2]; s = cumsum(A)

mehr als 3 Jahre vor | 1

Beantwortet
Integration of Numeric Data in cycle
Work on your data first so that you get a closed, non-overlapping curve. Especially "clean" the upper and the right part. Then a...

mehr als 3 Jahre vor | 0

Beantwortet
How to set Dirichlet boundary condition on 1-D poisson equation FEM
It is hard to follow your coding, but my guess is that the boundary conditions at both ends are not incorporated in the linear s...

mehr als 3 Jahre vor | 0

Beantwortet
Plotting a multivariable function, that also has a summation
xstart = 0.0; xend = 1.0; nx = 100; tstart = 0.0; tend = 5.0; nt = 100; nsum = 31; X = linspace(xstart,xend,nx); T...

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
while loop or loop
prompt = "Input x "; x = input(prompt) while x > 2500 && x < 2501 disp("Wrong value for x") disp("x must not be in the i...

mehr als 3 Jahre vor | 0

Beantwortet
How can I find the coeficients alpha, beta of the simple linear regression, using polyfit function?
x = (0:0.1:1).'; y = 3*x + 4 + 0.01*randn(numel(x),1); polyfit(x,y,1)

mehr als 3 Jahre vor | 0

| akzeptiert

Beantwortet
How can I find the coeficients alpha, beta of the simple linear regression, using "\" operator
x = (0:0.1:1).'; y = 3*x + 4 + 0.01*randn(numel(x),1); A = [x,ones(size(x))]; b = y; coeffs = A\b; coeffs(1) coeffs(2)

mehr als 3 Jahre vor | 0

Beantwortet
ODE-Runge Kutta
Maybe of interest for comparison. Seems we get different results - also for the code with only backward differencing. But this ...

mehr als 3 Jahre vor | 0

Beantwortet
Find which columns have duplicates
Transpose the matrix :-) Or: ColumnsWithDuplicates = find(arrayfun(@(i)(~isequal (length (unique (A(:,i))), size(A,1))), 1:siz...

mehr als 3 Jahre vor | 0

Beantwortet
Multiple 3d random walks
lambda = 3; %Mean free path numberOfSteps = 10000; % Total number of steps numberOfPaths = 3; % Number of paths x(1,:) = ra...

mehr als 3 Jahre vor | 1

| akzeptiert

Mehr laden