Answered
3D plot on 3D matrix
You can use pcolor/ surf. You can plot w.r.t indices. val = rand(10,5,2) ; % using pcolor subplot(211) pcolor(val(:,:,1))...

6 years ago | 0

Answered
How to find the point at which a line becomes perpendicular to another line?
x = [150 0] y = [0 150] C = [0 0] ; % get the line ax+by+c = 0 slope = diff(y)/diff(x) ; % slope a = slope ; b = -1...

6 years ago | 0

| accepted

Answered
Inserting a row in a matrix in a precise place
A = [ 2 8 3 11 ; 13 33 4 5 ; 18 8 4 7 ; 23 4 6 11 ] ; b = [ 8 4 23 9 ] ; idx = find(A(:,1)<b(1))+1 ; % get the positon whe...

6 years ago | 0

Answered
Trying to get all results from a for loop into an array
clc clear close all format long G % Given variables xpos = 4.000; % Initial x position ypos = 0.000; ...

6 years ago | 0

Answered
How do I put red dots on the original image?
You can use holdon and the use plot. You can use MarketSize and MarkerShape etc....many other options are there.

6 years ago | 0

Answered
How to read a hexadecimal numbers and flip
str = "00 00 00 02 78 0B 09 00 DA 7F" ; str = fliplr(strsplit(str)) ; iwant = strjoin(str) ;

6 years ago | 1

Answered
Magnetic Field Given Bx, By,Bz and Given XYZ of Spacecraft
You can use quiver3. Read about it. https://in.mathworks.com/help/matlab/ref/quiver3.html

6 years ago | 0

Answered
Retrieve original index from a masked array
Repalce the other elements in A with NaN other than mask. B = A ; B(~m) = NaN ; [~,i] = min(B); % now the index will be of...

6 years ago | 1

| accepted

Answered
loop for sum and average for specific rows
A = rand(300,1) ; B = reshape(A,12,[]) ; thesum = sum(B,2) ; themean = mean(B,2) ;

6 years ago | 0

| accepted

Answered
Splitting a matrix into addition of two same size Matrices
x3 = rand(12) ; A = rand ; B = rand ; C = rand ; P = A*x3.^2+B*x3+C ; If A, B, C are matrices x3 = rand(12) ; A = ...

6 years ago | 0

Answered
How to use one function in another function
Easy save all the functions in same folder and run. function val = TwoSum(a,b) val = a+b; end function val = ThreeSum...

6 years ago | 0

Answered
To calculate the area under a series of curves
Read about trapz.

6 years ago | 1

Answered
Sorting an array and their corresponding
[val,idx] =sort(a) ; iwant = b(idx) ;

6 years ago | 0

| accepted

Answered
How can I extract column names from xls sheet and make them workspace variables?
Time = Mockdata.Time ; Depth = Mockdata.Depth ;

6 years ago | 0

| accepted

Answered
Code to read files from ansys fluent and perform calculations
Read about textscan. fid = fopen('Myfile.txt','r') ; S = textscan(fid,'%f %f\n','HeaderLines',4) ; S = S{1} ; fclose(fid...

6 years ago | 0

| accepted

Answered
Find out how long after division will be an integer?
if mod(x,1)==0 then x is an whole number/ integer.

6 years ago | 0

Answered
Reshaping a matrix and binding two values together
iwant = reshape(randperm(20),10,2) ;

6 years ago | 0

Answered
I want to creat a m matrix = [m1 0;0 m2] with varying m2 parameters in the m matrix.
m1 = 1 ; m2 = 0.01:0.01:0.1 ; N = length(m2) ; m = zeros(2,2,N) ; m(1,1,:) = m1 ; m(2,2,:) = m2 ;

6 years ago | 0

| accepted

Answered
How to get XYZ data in equal interval
Read about griddata, scatteredInterpolant.

6 years ago | 0

| accepted

Answered
Plotting Pixel count in a image
I = imread(myimage); R = I(:,:,1); G = I(:,:,2); B = I(:,:,3); [R_data, level] = imhist(R); [G_data, level] = imhist(G); [...

6 years ago | 0

Answered
peak finding of a graph
load("matlab_peak.mat") ; x=V1_1_new ; y=y1_1_new ; [pks,idx] = findpeaks(y) ; plot(x,y) hold on plot(x(idx),y(idx)...

6 years ago | 0

| accepted

Answered
loop and mixing solution
A = 0:10:100 ; B = A ; C = A ; [A,B,C] = meshgrid(A,B,C) ; % convert them to columns A = A(:) ; B = B(:) ; C = C(:) ; ...

6 years ago | 0

| accepted

Answered
Using fprintf to display multiple strings
fprintf('%s + %s',char(955),char(955))

6 years ago | 0

Answered
How do I merge 2 graphs with both a normal and reversed x-axis
If you have array a, you can reverse it by calling a(end:-1:1)

6 years ago | 0

Answered
Matrix define using for loop
Read about diag. A = -4*ones(9,1) ; B = [1 1 0 1 1 0 1 1] ; C = ones(1,6) ; iwant = diag(C,-3)+ diag(B,-1) + diag(A) +...

6 years ago | 1

| accepted

Answered
Multiple lines and units MATLab Graph
You may try this: https://in.mathworks.com/help/matlab/creating_plots/graph-with-multiple-x-axes-and-y-axes.html

6 years ago | 0

Answered
How do I run this iteration?
NTU = linspace(0.1,0.2) ; Cr = linspace(0.2,0.3) ; [NTU,Cr] = meshgrid(NTU,Cr) ; eps = 1-exp(-NTU.*(1 + Cr))./(1+Cr) ; % ...

6 years ago | 0

Answered
Creating image mask of pizza-shape
I will use ocr of MATLAB https://in.mathworks.com/help/vision/examples/recognize-text-using-optical-character-recognition-ocr.ht...

6 years ago | 0

Answered
Help plotting piecewise function?
YOu can proceed like this: x = 1:10 ; y = zeros(size(x)) ; N = 1 ; % x is even idx = 2:2:length(x) ; y(idx) = [(3./x...

6 years ago | 0

Load more