Answered

i was writing a equation but this always have an error and i cant run it

You should first define the constants and then type the formula. T= 1000; L=10; W=100; S=100000; %% this is tha value of ...

i was writing a equation but this always have an error and i cant run it

You should first define the constants and then type the formula. T= 1000; L=10; W=100; S=100000; %% this is tha value of ...

6 days ago | 1

| accepted

Answered

Create a box around points and use in inpolygon

load("polygon1_x.mat") ; load("polygon1_y.mat") ; load("lon.mat") ; load("lat.mat") ; % remove Nan's from the data xv ...

Create a box around points and use in inpolygon

load("polygon1_x.mat") ; load("polygon1_y.mat") ; load("lon.mat") ; load("lat.mat") ; % remove Nan's from the data xv ...

6 days ago | 1

| accepted

Answered

How to use ginput to determine the coordinates of an image

You have dimensions of each image...say dimensions of each image [m,n,3]. Initiate a matrix idx such that, each quarter has the ...

How to use ginput to determine the coordinates of an image

You have dimensions of each image...say dimensions of each image [m,n,3]. Initiate a matrix idx such that, each quarter has the ...

7 days ago | 0

| accepted

Answered

how can i write the code out for this 1-1/2+1/3-1/4+1/5-,.....

It is your Home work..you have to do it. Do the following. Read about for loop. Fix the value of n, to run a loop. You can...

how can i write the code out for this 1-1/2+1/3-1/4+1/5-,.....

It is your Home work..you have to do it. Do the following. Read about for loop. Fix the value of n, to run a loop. You can...

8 days ago | 0

Answered

How to find the exact index(row, col) of a maximum value in a matrix?

Let I be your image. [m,n,p] = size(I) ; x = 1:n ; y = 1:m ; [X,Y] = meshgrid(x,y) ; [val,idx] = max(I(:)) ; imshow(I...

How to find the exact index(row, col) of a maximum value in a matrix?

Let I be your image. [m,n,p] = size(I) ; x = 1:n ; y = 1:m ; [X,Y] = meshgrid(x,y) ; [val,idx] = max(I(:)) ; imshow(I...

9 days ago | 0

| accepted

Answered

strength of materials in matlab

P = [0 0] ; L = 1000 ; % length of beam B = 0.5 ; % breadth of beam B = [P ; L P(2) ; L B ; P(1) B] ; patch(B(:...

strength of materials in matlab

P = [0 0] ; L = 1000 ; % length of beam B = 0.5 ; % breadth of beam B = [P ; L P(2) ; L B ; P(1) B] ; patch(B(:...

9 days ago | 0

Answered

How to make a contour plot with data from using ode45

X= linspace(1,5,5); % Vector for alpha_p values Y= linspace(0.5,3,5); % Vector for beta_p values [A, B]= meshgrid(X,Y); nt ...

How to make a contour plot with data from using ode45

X= linspace(1,5,5); % Vector for alpha_p values Y= linspace(0.5,3,5); % Vector for beta_p values [A, B]= meshgrid(X,Y); nt ...

9 days ago | 0

Answered

Find the general solution of the equation y ′ − y = y 2 e x .

syms y(x) ode = diff(y,x)-y==y^2*exp(x) ; sol = dsolve(ode)

Find the general solution of the equation y ′ − y = y 2 e x .

syms y(x) ode = diff(y,x)-y==y^2*exp(x) ; sol = dsolve(ode)

11 days ago | 0

Answered

Let A and B be square matrices of same order. Prove that characteristic polynomials of AB and BA are same. Do AB and BA have same minimal polynomial ?

Calculate the eigenvalues of the product. They will be euqal. A = rand(2) ; B = rand(2) ; AB = eig(A*B) BA = eig(B*A)

Let A and B be square matrices of same order. Prove that characteristic polynomials of AB and BA are same. Do AB and BA have same minimal polynomial ?

Calculate the eigenvalues of the product. They will be euqal. A = rand(2) ; B = rand(2) ; AB = eig(A*B) BA = eig(B*A)

11 days ago | 0

Answered

if(0.41 == (41*0.01)) is False and if(0.42 == (42*0.01)) is True .. Why?

Read about comparing floating-point numbers. tol = 10^-5 ; if(abs(0.41-(41*0.01)<=tol)) %First Condition disp('tr...

if(0.41 == (41*0.01)) is False and if(0.42 == (42*0.01)) is True .. Why?

Read about comparing floating-point numbers. tol = 10^-5 ; if(abs(0.41-(41*0.01)<=tol)) %First Condition disp('tr...

11 days ago | 0

| accepted

Answered

Error: Brace indexing is not supported for variables of this type.

datevec = cell2mat(datenum); Or check class(datenum) It should be already a converted to double.

Error: Brace indexing is not supported for variables of this type.

datevec = cell2mat(datenum); Or check class(datenum) It should be already a converted to double.

11 days ago | 0

| accepted

Answered

Sum of two numbers is not accepted

Read about comparing two floating-point numbers. a=0.14+0.001; tol = 10^-5 ; idx = abs(M(:,2)-a)<=tol ; M(idx,:)=[];

Sum of two numbers is not accepted

Read about comparing two floating-point numbers. a=0.14+0.001; tol = 10^-5 ; idx = abs(M(:,2)-a)<=tol ; M(idx,:)=[];

11 days ago | 0

| accepted

Answered

How to remove the grid from plot

x = linspace(0,10); [X,Y] = meshgrid(x,x); z = X.*Y; pcolor(x,x,z); shading interp

How to remove the grid from plot

x = linspace(0,10); [X,Y] = meshgrid(x,x); z = X.*Y; pcolor(x,x,z); shading interp

11 days ago | 1

| accepted

Answered

Matrix dimensions must agree error

Ws=2*pi*60; tetha=0; t=0:0.0001:0.1; v1=linspace(1,30,length(t)); % it can be v1=1:1:30 N=45; I=10; p=2; K =(2*N*I)/(pi*...

Matrix dimensions must agree error

Ws=2*pi*60; tetha=0; t=0:0.0001:0.1; v1=linspace(1,30,length(t)); % it can be v1=1:1:30 N=45; I=10; p=2; K =(2*N*I)/(pi*...

11 days ago | 0

| accepted

Answered

How can I plot a unit vector in 3-D space?

You need not to use that complex, time consuming loop to get what you want. clear all close all clc N=101; x=linspace(-10,...

How can I plot a unit vector in 3-D space?

You need not to use that complex, time consuming loop to get what you want. clear all close all clc N=101; x=linspace(-10,...

11 days ago | 0

| accepted

Answered

mean over over multiple dimensions and multiple arrays

% make dummy data N = 8 ; for i = 1:N C{i} = rand(2,2,3) ; end % get the mean N = length(C) ; [m,n,p] = size(C{1})...

mean over over multiple dimensions and multiple arrays

% make dummy data N = 8 ; for i = 1:N C{i} = rand(2,2,3) ; end % get the mean N = length(C) ; [m,n,p] = size(C{1})...

11 days ago | 1

| accepted

Answered

How to extract a 1D dose at certain depth in x,y or z-direction from a 3D array?

I feel slice is your function.... load("xdim.mat") ; load("ydim.mat") ; load("zdim.mat") ; load("3d_dose data.mat") ; ...

How to extract a 1D dose at certain depth in x,y or z-direction from a 3D array?

I feel slice is your function.... load("xdim.mat") ; load("ydim.mat") ; load("zdim.mat") ; load("3d_dose data.mat") ; ...

11 days ago | 0

Answered

Sum of elements in cell array

Better use loop to avoid confusion using cellfun. Note cellfun also use loop inside. clc; clear all ; load("numerical.mat"); ...

Sum of elements in cell array

Better use loop to avoid confusion using cellfun. Note cellfun also use loop inside. clc; clear all ; load("numerical.mat"); ...

11 days ago | 0

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))...

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))...

11 days 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...

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...

11 days 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...

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...

12 days 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; ...

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; ...

12 days 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.

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.

12 days 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) ;

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) ;

12 days 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

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

12 days 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...

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...

12 days 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) ;

loop for sum and average for specific rows

A = rand(300,1) ; B = reshape(A,12,[]) ; thesum = sum(B,2) ; themean = mean(B,2) ;

12 days 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 = ...

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 = ...

12 days 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...

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...

12 days ago | 0