Réponse apportée
Make array with elements repeating as many times as specified in another list.
a{1} = [1, 2, 4]; a{2} = [5, 3, 8, 9]; a{3} = [2, 6, 3, 7, 8, 1]; y_val = repelem(1:length(a), cellfun('length', a))

plus de 2 ans il y a | 2

Réponse apportée
Adjacency matrix.I want to simply the code .
n = 10; x=accumarray([2 3 n-1 n]',1); B = toeplitz(x,x); G=graph(B); plot(G)

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
Generate random integers that sums to a specific number within a specific range
Revisit this old thread here is the randfixedsum version but for integers. It's a quick implementation and it is slow, but math...

plus de 2 ans il y a | 1

Réponse apportée
Move a Point on a 3D surface
% Generate test mesh x = 1:15; y = 1:15; [X,Y] = meshgrid(x,y); Z = peaks(15); F = delaunay(X,Y); % Your points to be p...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
How can I extract multiple rows from an array at regular intervals?
No need for reshape and repmat, etc... A = reshape(1:720, 72, 10); B = A((0:12:66) + (1:6)', :) % 66 is size(A,1)-6

plus de 2 ans il y a | 2

Réponse apportée
how to write all the for loop outputs in a single vector
function y = everyOther(x) L = length(x); i = 1:2:L; y = zeros(size(i)); for j = 1:length(i) y(j) = x(i(j)); end end

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
I don't want any imaginary number , and I don't want any negative number in my matrix, but none of MathWork can even answer it.
Just add the max statement to clamp the variable nu01 whenever you set nu01 (2 places): nu01(1,w+1,z) = ...; nu01(1,w+1,z) =...

plus de 2 ans il y a | 1

Réponse apportée
converting matlab into python using an official matlab add on
Not official but recently I need to do conversion of a small function, and ChatGPT works great.

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
Is it possible to restore all the variables from the previous session?
Unfortunately no. It's up to you to regularly save the intermediate results and make you program able to warn start from where ...

plus de 2 ans il y a | 0

Réponse apportée
Which method I can use for reduce number of samples or Increase the samples?
Take a look at interp1 https://www.mathworks.com/help/matlab/ref/interp1.html

plus de 2 ans il y a | 0

Réponse apportée
Fastest way to convert nested cell arrays into a Matrix?
If the deep nested arrays are column vectors Tmp=cat(2,ExampleCellArray{:})'; OutputMatrix=reshape(cat(2,Tmp{:})', [A_Length B...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
How can I do to break this while loop with the keyboard?
Try this test function test fig = uifigure(); ax = uiaxes('Parent', fig); h = plot(ax, NaN); stop = false; function...

plus de 2 ans il y a | 1

| A accepté

Réponse apportée
scatteredInterpolant gives out NaN in some query points
Probably your data contains NaN at one or several points. I don't quite understand your code datau.Value seems not valid sin...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
Why the calculation error enhances as the phase angle increases when using atan2?
It doesn't seem weird to me. Both of the (atan2+unwrap) and (sin+cos) do somekind of undo modulo 2*pi differently. unwrap make...

plus de 2 ans il y a | 0

Réponse apportée
Nested parfor effecting fprintf?
I add this line before the IF test something = rand() < 0.01 if(something) break end it works for me, my command window...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
All combinations of a data set without mixing data across arrays
If you have R2023a use the stock combinations function Var1 = [1400, 1700, 1900]; Var2 = [1340, 1680, 1900, 1871, 789]; Var3 ...

plus de 2 ans il y a | 0

Réponse apportée
Discrepancy between local maxima of cfit and global minima in second derivative
You missunderstand and missinterpret the second derivative. At the local minima the first derivative is 0 and the second deriv...

plus de 2 ans il y a | 1

Réponse apportée
how can i vectorize it?
If you prefer ugly and unreadable code %I BUILD DATA IN THIS EXAMPLE row=10; col=8; profit = rand(row,col); c3 = randi(si...

plus de 2 ans il y a | 1

| A accepté

Réponse apportée
Solving an overdetermined linear system
least square solution syms e0 e1 e2 T1=1; T2=3; T3=4; T4=5; T5=6; TM1=8; TM2=7; TM3=6; TM4=5; TM5=4; Eqns = [e0 + T...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
Reshape matrix dimensions to a larger and sparse one
A = [0.8147 0.1576 0.6557 0.7060; 0.9058 0.9706 0.0357 0.0318; 0.1270 0.9572 0.8491 0.2769;...

plus de 2 ans il y a | 0

| A accepté

Question


When assignment is allowed?
The question concerns the requirement of the sizes of the assignment between two arrays. To my great surprise this is allowed ...

plus de 2 ans il y a | 1 réponse | 1

1

réponse

Réponse apportée
How to use "eig" function in optimproblem?
Put whatever you want to compute (with eig) in a standard matlab function (e.g., in an mfile) then use fcn2optimexpr to convert ...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
Efficient and quick way to summation of large data points
instead of doing over and over (in the loop on the bottom) such calculation sum(omega(i1:i2)); you could do once the cumulati...

plus de 2 ans il y a | 0

Réponse apportée
i just want to know the given code is correct or not.
Replace the calculation with epsilon_complex = (epsilon_inf + sum(A ./ (C.^2 - E^2 - 1i * v * E))); epsilon_real = real(epsilo...

plus de 2 ans il y a | 0

Réponse apportée
How I would determine if a string contains multiple substrings?
myString = "This has some words in it."; subStrings = ["This","some"]; hasAllSubstrings = isequal(regexp(myString, subString...

plus de 2 ans il y a | 2

Réponse apportée
Implement the "total variation distance" (TVD) in Matlab
Supremum is very often implemented by max, since one can only list or compute a finite set on computer. However your formula d...

plus de 2 ans il y a | 1

| A accepté

Réponse apportée
Error using .' TRANSPOSE does not support N-D arrays. Use PAGETRANSPOSE/PAGECTRANSPOSE to transpose pages or PERMUTE to reorder dimensions of N-D arrays.
Your image I is 3D RGB not 2D so you have to do 2D interpolation page by page for k = size(I,3):-1:1 I2(:,:,k) = interp2...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
Calculating the area of overlapping polgyons
Is it what you want? (I'm not sure about the desired output if polygons are not hierachical included to each other, see variant ...

plus de 2 ans il y a | 0

| A accepté

Réponse apportée
Can't find references for lqr.m
https://www.mathworks.com/products/control.html

plus de 2 ans il y a | 0

A soumis


randinrc
randi with non-repeat constraint.

plus de 2 ans il y a | 1 téléchargement |

0.0 / 5

Charger plus