Beantwortet
Ellipsoid plot_ wireframe view
[Q,~] = qr(randn(3)); h = rand(3,1); h1 = h(1); h2 = h(2); h3 = h(3); % If your principal axis are (3x1) P1, P2, P3 and h...

etwa 7 Jahre vor | 1

| akzeptiert

Beantwortet
How can I multiply two big matrices, avoiding out of memory?
You can process by chunk of smaller (100 here); % Generate small test data m = 100; n = 100^2; C = rand(m^2,3); % your [alph...

etwa 7 Jahre vor | 0

| akzeptiert

Beantwortet
How to sort a matrix's columns by using indexes
Short answer data = data(:,indA); Long answer load lung.mat data=lung; b = data(:,end) == 1; data1 = data(b,:); data2 ...

etwa 7 Jahre vor | 0

Beantwortet
Switching an array of Vectors from Cartesian to Spherical Coordinates
OK since nobody care to give you the complete commands I'll [az,el,r] = cart2sph(V(1,:),V(2,:),V(3,:)); S = [az; el; r]; % <- ...

etwa 7 Jahre vor | 0

Beantwortet
Minimum and maximum values of a field in a structure array
arrayfun(@(s) min(s.f1), s)

etwa 7 Jahre vor | 0

| akzeptiert

Beantwortet
Row with means of each column in matrix
A = [A; mean(A,1)]

etwa 7 Jahre vor | 0

Beantwortet
Matlab Gui Column Calculation Problems adds 48
Convert your GUI Data input using str2double, str2num etc >> str2double('0')+1 ans = 1 >> '0'+1 ans = 4...

etwa 7 Jahre vor | 0

| akzeptiert

Beantwortet
Sorting specific values of one matrix into another
Why not use Connected graph component?

etwa 7 Jahre vor | 0

Beantwortet
How to get the longest consecutive values in a column vector and the position at which it starts
A=[0 0 0 1 0 1 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1]' i=reshape(find(diff([0;A;0])~=0),2,[]); [lgtmax,jmax]=max(diff(i)); istart...

etwa 7 Jahre vor | 2

| akzeptiert

Beantwortet
I want the code to randomize the rows and present each row for 10 times
The array B of the below has exactly 10 times each row of A in random order: m = size(A,1); B = A(mod(randperm(10*m),m)+1,:); ...

etwa 7 Jahre vor | 0

Beantwortet
Generate matrix that is a product of its indices
n = 5; i = (1:n)'; j = 1:n; M = i.*j - (i+j)

etwa 7 Jahre vor | 1

| akzeptiert

Beantwortet
permutations of a matrix
x = (1:5)'; n = size(x,1); m = 5; % size of b s = 3; % target sum(A(:)) [i,k] = ind2sub([m,n],nchoosek(1:m*n,s)); j = re...

etwa 7 Jahre vor | 1

Beantwortet
how do I improve this code?
x = [2 5 6 7 8]; y = [1 3 4 8 9]; z = x.*y; z(10) = 0; c = cumsum(z);

etwa 7 Jahre vor | 1

| akzeptiert

Beantwortet
How to close the boundary of a surface already generated by filling the holes
Add the salt to suit your need Aorg = xlsread('Y_slice.xlsx'); gapmax = 5; % adjust to your need [m,n] = size(Aorg); A...

etwa 7 Jahre vor | 1

Beantwortet
simple integration calculation to find the area ?
trapz(T,V)

etwa 7 Jahre vor | 0

| akzeptiert

Beantwortet
determine combination of elements in matrix
lgt = 4; % number of elements nz = 2; % number of 0s j = nchoosek(1:lgt,lgt-nz); i = repmat((1:size(j,1))',[1 size(j...

etwa 7 Jahre vor | 0

Beantwortet
Copy a figure to a subplot including all elements
close all fig1 = figure(1); ax = axes('parent',fig1); h=plot(ax,rand(1,10)); xlabel(ax,'x'); ylabel(ax,'y'); title(ax,'s...

etwa 7 Jahre vor | 4

Beantwortet
Plot of an ellipsoid
% If your principal axis are (3x1) P1, P2, P3 and half length are (scalars) h1, h2, h3 Q = [P1(:), P2(:), P3(:)]; Q = Q .* ([...

etwa 7 Jahre vor | 0

Beantwortet
Find the angle between two points in 3D plot.
if the 3D (x-y-z) coordinates of your two points are P1 and P2, both are (3 x 1) or (1 x 3) vectors angleradian = acos((P2(2)-P...

etwa 7 Jahre vor | 1

| akzeptiert

Beantwortet
How do you chop a number to a specified number of significant digits, not round
2 digits fix(x*100)/100

etwa 7 Jahre vor | 2

Beantwortet
Using maximum of optimisation variable as an upper bound for another variable
Not sure what you mean by "boundary condition" (there is no such thing in all optimization frameworks as far as I know), but tak...

etwa 7 Jahre vor | 0

Beantwortet
Draw partial spheroid include a spheroid
The code bellow us this FEX to generate mesh points. % radius of the inner/outer spherical parts r1 = 1; r2 = 2; n = 20; %...

etwa 7 Jahre vor | 1

| akzeptiert

Beantwortet
How to trim segments to fit a square
% Generate some test data, put 100 instead of 20 if you like X1=rand(20,1)*40; X2=rand(20,1)*40; Y1=rand(20,1)*60-10; Y2=r...

etwa 7 Jahre vor | 1

Beantwortet
Create volume out of two surfaces
Tetra mesh generation. Let you do exportation in STL file % Points in xy-plane nx = 100; px = linspace(1,50,nx); pyi = 5+s...

etwa 7 Jahre vor | 0

| akzeptiert

Beantwortet
pairs of consecutive numbers
A=[5 3 4 1]; As=sort(A); b=diff(As)==1; pairs=As(b)'+[0 1]; notpair = setdiff(A,pairs(:))

etwa 7 Jahre vor | 1

Beantwortet
How can I rotate and reflect subplots as a group?
x = rand(5,9); y = rand(5,9); c = rand(5,9); close all % Normal figure for h=1:9 [m,n] = ind2sub([3 3],h); ...

etwa 7 Jahre vor | 0

Beantwortet
how to add all 2d matrices in a 4D matrix???
sum(sum(A,3),4) or sum(A(:,:,:),3)

etwa 7 Jahre vor | 0

| akzeptiert

Beantwortet
Calculation of unknown values of two equations without Symbolic Math toolbox
C = [1 1; -3 -2] \ [29; -70]

etwa 7 Jahre vor | 0

| akzeptiert

Beantwortet
Multiplying 3D matrices
There is no stock function (what a MATRIX LABORATORY doesn't have such feature?), but here it is MTIMESX

etwa 7 Jahre vor | 0

| akzeptiert

Beantwortet
How to round up components of a matrix to 1
>> A=[0.818655843258541 0.381356605388963 0.286089112378312 -0.0340005479718328 0.0773489731425248 -0.0465565535336793 -0.0390...

etwa 7 Jahre vor | 0

| akzeptiert

Mehr laden