https://es.mathworks.com/matlabcentral/answers/questions?sort=relevance+desc&term=product%3AMATLAB Answers — New Questions matching product:2020-04-04T15:21:41Ztag:es.mathworks.com,2005:Question/140462011-08-19T12:09:14Z2011-08-19T12:09:14ZI didn't understand how put the inputs in tprod functionHow have I to put the input in _tprod_ to have the same result of the code that follows?
a=rand(3,4,5);
b=rand(4,6);
for i=1:5
c(:,i,:)=a(:,:,i)*b;
end
[edit: matrix dimension corrected]Francescohttps://es.mathworks.com/matlabcentral/profile/authors/2401904-francescotag:es.mathworks.com,2005:Question/560382012-12-08T03:13:38Z2012-12-08T03:13:38ZProduct of probabilities by groupHi,
I have matrix that contains in the first column a group identifier and in the second column a probability. I want to generate, for each group identifier, the product of the probabilities that correspond to that group.
For example
X=[1 0.5;1 0.3; 1 0.4; 2 0.7; 2 0.4];
What I want is to generate a matrix
Y=[1 (0.5*0.3*0.4);2 (0.7*0.4)];
and I can't do it "by hand" because the number of groups and the number of probabilities is huge.
Any ideas? Thanks.Fernandohttps://es.mathworks.com/matlabcentral/profile/authors/3325033-fernandotag:es.mathworks.com,2005:Question/873342013-09-16T13:21:22Z2013-09-16T13:21:22ZA question about product operationHello all!
I'm not sure if this was explained before, but I could not find any answer to this.
So, if i have x=[a b c] and y=[d e f] I'd like to know (if it's possible) how I could obtain:
.
z=
h i j
k l m
n o p
where:
h=a*d k=a*e n=a*f
i=b*d l=b*e o=b*f
j=c*d m=c*e p=c*f
Thanks!
Dan Phttps://es.mathworks.com/matlabcentral/profile/authors/4595224-dan-ptag:es.mathworks.com,2005:Question/501372012-10-08T03:48:52Z2012-10-08T03:48:52ZIs there any notation for the calculation of this sum ??I want to calculate a sum of products of the form :
1.1*a^2*b^9+1.4*a^7*b^4+0.25*a^6*b^8
where a and b are constants.
This expression is the sum of 3 products, I am giving it just for simplification, but the reality is that I have to calculate a sum of 47 products of this form and in each product the coefficients (1.1, 1.4, 0.25) are different and the powers (2, 9, 7, 4, 6, 8) are also different from one product to the other.
So, my question is : Is there any notation that I can use to calculate the sum above without having to repeat each time the constants a and b ?? kamal kikihttps://es.mathworks.com/matlabcentral/profile/authors/3028151-kamal-kikitag:es.mathworks.com,2005:Question/570102012-12-19T22:20:16Z2012-12-19T22:20:16ZBuild a matrix of data and insert them in a functionI have a function. Suppose
function y=A(1)*B+A(2)
in which A is an array of _2 x m_ elements and B is a vector of n elements. The _A(1,:)_ is varies while _A(2,:)_ is a contant number. I would like to multiply all the elements of B with each one of the elements of A in order to build a matrix of y outputs.
My ultimate goal to mesh all this data and produce surface plot.
I would like to use for loops to avoid the dots before the operators because actually I have a complicated function
Thank you.
Giorgos Papakonstantinouhttps://es.mathworks.com/matlabcentral/profile/authors/3060153-giorgos-papakonstantinoutag:es.mathworks.com,2005:Question/5153282020-04-04T14:42:27Z2020-04-04T15:21:41Zelement wise product matrix-vectorI have a 200x5 matrix (Y) that includes 5 time series and a 5x1 vector of weights (w). For each t (row of the matrix), I need to compute the following element-wise product:
How can I do that?
Thank youAlexhttps://es.mathworks.com/matlabcentral/profile/authors/16425759-alextag:es.mathworks.com,2005:Question/816602013-07-10T12:37:55Z2013-07-10T12:37:55ZMatlab command for the following symbol: ∏ (Capital Pi / product of a sequence of terms)Hi
I have an equation that i want to implement in Matlab and it has the following symbol ∏ (used to denote Capital Pi or the product of a sequence of terms).
I want to know what is the matlab command for ∏?Syedhttps://es.mathworks.com/matlabcentral/profile/authors/4419695-syedtag:es.mathworks.com,2005:Question/5009752020-01-19T15:22:10Z2020-01-22T04:55:50ZSolving an equation with terms that require double summation and productsI need to solve the following equation.
I wrote the following code based on the above equation, but I believe I have made a mistake as the final answer is large.
I have attached the *.mat file for reference.
Any assistance would be much appreciated.
% Condition number for the optimal distribution of the hole-drilling depth increments, base on the "Integral Method" for the non-uniform hole-drilling residual stress measurement technique
% Determination of the condition number for the optimal distribution of the hole-drilling depth increments,
% base on the "Integral Method" for the non-uniform hole-drilling residual stress measurement technique.
% The following equation as referenced from this source (see below) is used
% for this determination.
% https://link.springer.com/article/10.1007/BF02331114
% Develop the terms of the equation
% The individual terms of the equation will be developed individually and then brought together.
% Loading the files
% Loading the required variables.
% Loading of the required *.mat file and then the variable.
anp = load("191231_GS_0295_10.mat","aij");
aij = anp.aij
% Length of array
N = length(aij)
% Summation of matrix
aij_2 = aij^2
y1 = sum(aij_2(:))
% Product of the matrix
aii = diag(aij)
aii_2 = aii.^2
% Product of the square of the diagonal of the matrix
y2 = 4*prod(aii_2,"all")
% The complete equation is as follows:
K_A = (y1 + (y1.^2-y2).^0.5)./y2GS76https://es.mathworks.com/matlabcentral/profile/authors/5020766-gs76tag:es.mathworks.com,2005:Question/4271312018-10-31T11:33:16Z2018-10-31T11:36:20ZHow do i find the product of all the numbers in my matrixfinding the product of all my numbers in 1:20Nicholas Cappellinohttps://es.mathworks.com/matlabcentral/profile/authors/13320565-nicholas-cappellinotag:es.mathworks.com,2005:Question/4175402018-09-04T23:49:20Z2018-09-08T22:13:04ZA fast way to perform sparse matrix-free product with a vector Dear all,
I was wondering if it is possible to increase the performance of a matrix-free product of a sparse matrix defined by 3 vectors (rows, columns and values) with another vector {B}. That is:
A(l,m)=v and performing {C}=[A]*{B}
So far I have the following strategy:
function C = mfree_times(l,m,v,B)
aux = B(m);
prod = v.*aux;
C = accumarray(l,prod);
end
My intentions are to increase this performance as much as possible. The bottleneck is majorly given by accumarray function. I am already using l, m and v as gpuArrays. Please share your thoughts. Thanks!
Paulo Ribeirohttps://es.mathworks.com/matlabcentral/profile/authors/11292284-paulo-ribeirotag:es.mathworks.com,2005:Question/2178762015-05-21T06:55:28Z2015-05-21T17:48:19ZQuestion about 2D Vector MultiplicationI just have a simple question about vector multiplication in MATLAB.
Let's say I have these two vectors:
A=[1 2 3 4 5]
B=[6 7 8 9 1]
Now normally if you would multiply these you would get need to do a transpose of either one to get a dot product, however, I want to ask if it's possible to do something like the following:
Take the first value in Set A and multiply it once with each number in B (so on and so forth), to give something like:
6 12 18 .
7 14 21 .
8 16 24 .
9 18 27 .
1 2 3 etc
I'm sure there must be a simple way to do it but I can't figure it out and also possibly you can find a way to expand and do it manually, but a function would be ideal. I have 160 lines of code that I need to do this with.
Help would be appreciated! Thank you!mentalfictionhttps://es.mathworks.com/matlabcentral/profile/authors/6070531-mentalfictiontag:es.mathworks.com,2005:Question/931852011-03-08T20:18:00Z2019-11-15T15:17:08ZHow can I generate a License Report?I am aware that I can use the license center to administer my licenses. I would like to see detailed information regarding license usage, is it possible to view this information in a comprehensive report?
MathWorks Support Teamhttps://es.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:es.mathworks.com,2005:Question/4293742018-11-12T12:31:15Z2018-11-12T14:14:39ZComputing A(:, m)*B(m, :) without a for loopProvided I have two matrices A and B of dimensions NxM and MxN I want to compute a matrix C of dimensions NxNxM such that each NxN slice is the result of the prduct A(:, m)*B(m, :). I know this can be obtained in the following way:
for m=1:M
C(:, :, m) = A(:, m)*B(m, :);
end
Is there a way of obtaining the same result without using a for loop (with the aim of making the computation faster)?Nicolas Perezhttps://es.mathworks.com/matlabcentral/profile/authors/6793336-nicolas-pereztag:es.mathworks.com,2005:Question/2952222016-07-12T18:14:49Z2016-07-12T18:38:27ZHow can I multiply the columns of one matrix by another matrix most efficiently?I need to multiply the columns of one matrix by the columns of another matrix element-wise, and I would like to avoid loops. So far, I know that this will accomplish what I want done, but I would like to vectorize it if possible.
A = [1 2 3; 4 5 6; 7 8 9];
B = [1 1 1; 2 2 2; 3 3 3];
j = 1:size(A,2);
for i = 1:size(A, 2) % loop over columns
result(:, i*j) = bsxfun(@times, A(:, i), B);
end
Basically, given 2 MxN matrices my code outputs an MxN^2 matrix. Is there any built in function that will allow me to do this without the loop?
Thanks.Brandonhttps://es.mathworks.com/matlabcentral/profile/authors/4979172-brandontag:es.mathworks.com,2005:Question/2327302015-08-07T06:50:25Z2015-08-07T10:09:11ZMultiply x sequentially with items of a vectorDear MATLAB community,
I would like to construct an index, which should start with 100.
I have computed a vector, which then determines the change in the index in each time period.
For example, for 4 time periods:[1.1,1.2,1.3,1.4]
Basically, the operation should compute and produce the following vector:
# 100*1.1
# (100*1.1)*1.2
# ((100*1.1)*1.2)*1.3
# (((100*1.1)*1.2)*1.3)*1.4
Thank you very much in advance! I appreciate any help, as I am still a beginner with MATLAB.Christoph Meierhttps://es.mathworks.com/matlabcentral/profile/authors/6207659-christoph-meiertag:es.mathworks.com,2005:Question/888022013-10-01T14:23:40Z2013-10-02T10:04:26Zcan i make a matrix like this?
<</matlabcentral/answers/uploaded_files/313/matlab111.jpg>>
Austinhttps://es.mathworks.com/matlabcentral/profile/authors/4626518-austintag:es.mathworks.com,2005:Question/2963062016-07-19T09:03:29Z2016-07-19T11:25:29ZHow to concatenate (take cross product of) two datetime arrays?I have two arrays
Date = [datetime(2016,4,5), datetime(2016,5,4), datetime(2016,6,7)];
Time = duration(0,0:30:90,0,'Format', 'hh:mm:ss');
I want a product of these two arrays such that result is
ans =
5-Apr-2016 00:00:00
5-Apr-2016 00:30:00
5-Apr-2016 01:00:00
5-Apr-2016 01:30:00
4-May-2016 00:00:00
4-May-2016 00:30:00
4-May-2016 01:00:00
...Tushar Patelhttps://es.mathworks.com/matlabcentral/profile/authors/6507820-tushar-pateltag:es.mathworks.com,2005:Question/2579192015-11-28T04:10:29Z2015-11-28T04:14:03ZFinding product product of elements in a vectorI am using a vector whose length I want to vary. So supposing the vector is x = [f(1), f(2), f(3), ..... f(n)]. How do I find the product of all these entries multiplied with each other? I don't want to use cumprod because it gives me a vector output, but I only want the scalar output where the final answer is a product of all the entries.Margarita Gladkikhhttps://es.mathworks.com/matlabcentral/profile/authors/5431848-margarita-gladkikhtag:es.mathworks.com,2005:Question/3678942017-11-19T04:15:42Z2017-11-19T04:36:22ZFinding the product within an interval I have 250 element row vector of random numbers between intervals (-4.5, 5.5). Once I create that vector, how would I find the product of all elements between intervals (2.3, 2.6)?Noah Kebschullhttps://es.mathworks.com/matlabcentral/profile/authors/11122300-noah-kebschulltag:es.mathworks.com,2005:Question/1424542014-07-09T04:00:00Z2019-10-02T14:26:09ZWhich products are included in my license?I have just downloaded and installed MATLAB. I expected a particular toolbox to also be installed, but it isn't showing up in 'ver'. Where can I see if that toolbox is included on my MATLAB license?
MathWorks Support Teamhttps://es.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:es.mathworks.com,2005:Question/2965502016-07-20T04:00:00Z2017-11-14T15:51:06ZHow do I Assign or Transfer Products to my Licenses?How do I assign or transfer products to my licenses?
MathWorks Support Teamhttps://es.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:es.mathworks.com,2005:Question/645092013-02-22T08:31:13Z2013-02-22T08:31:13ZVectorization of product of flipped vectorsI'm looking for how to vectorize this loop :
r=zeros(1,length(r1));
for i=1:length(r1);
r(i)=sum(r1(1:i).*r2(i:-1:1));
end
r1 and r2 are two vectors of the same size.Tétefhttps://es.mathworks.com/matlabcentral/profile/authors/4091580-teteftag:es.mathworks.com,2005:Question/1735812015-01-30T15:11:02Z2015-01-30T17:08:23ZTake cartesian product between lists of tuples and a vectorI know matlab doesn't have tuples or vectors, but what I mean is say I have
A = [ 0 1 ; 2 3 ]
B = [ 4 5 ; 6 7 ]
C = [ 0 1 ]
I'd like to take the cartesian product of these items, like the "product" function from itertools in python.
product(A,B,C) =
[ 0 1 4 5 0;
0 1 4 5 1;
0 1 6 7 0;
0 1 6 7 1;
2 3 4 5 0;
2 3 4 5 1;
2 3 6 7 0;
2 3 6 7 1]
Is there a function in matlab that does this, accepting an arbitrary number of arguments? All the examples say "use meshgrid" which doesn't work in this case since that only takes the product of 2 or 3 vectors.
mrulehttps://es.mathworks.com/matlabcentral/profile/authors/1564617-mruletag:es.mathworks.com,2005:Question/1375482014-06-25T14:13:13Z2014-06-25T14:17:49ZHow to take the product of distinct array values? clc;
clear all;
close all;
Bx = 720;
By = 360;
g = gcd(Bx,By);
f = factor(g);
f_prod = prod(f);
In this example f = [ 2 2 2 3 3 5 ], and prod(f) = 360, but I just want to receive the product of distinct primes (i.e. 2*3*5). Is there a way to do this?Seanhttps://es.mathworks.com/matlabcentral/profile/authors/5385407-seantag:es.mathworks.com,2005:Question/4437592019-02-07T17:11:26Z2019-02-07T19:32:53Zsum of a product with i differnt to jHi All,
I want to calculate a sum of a product as following:
I think my problem is quite relative to this topic: Double sum of a product, but in my case I have j ~= i.
I think something like that should work:
t = 1:100;
n = 10;
a = randn(n,1);
P = [];
for i = 1:n
F = [];
for j = 1:n
if j~=i
f = (a(j)-a(i))^n*t;
F = [F,f'];
end
end
p = prod(F,2);
P = [P,p];
end
res = sum(P,2);
But I feel that this solution is not good and something easier should exist?
Thanks a lot,
M.MichMichelhttps://es.mathworks.com/matlabcentral/profile/authors/2535440-michmicheltag:es.mathworks.com,2005:Question/1030652009-06-27T01:11:00Z2009-06-27T01:11:00ZWhen using fixed-point data types with the "Product", "Matrix Multiply", and "Gain" blocks in Simulink, what determines the data type of the intermediate products and sums?I am using the "Product" block to perform matrix multiplication on fixed-point matrices and vectors. Are the intermediate products and sums carried out at a higher precision than the input and output data types?
MathWorks Support Teamhttps://es.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:es.mathworks.com,2005:Question/970252012-01-27T15:21:00Z2017-11-21T00:49:07ZWhy am I unable to move products between licenses under the same master license?I was under the impression that if products were under the same master license, I could move products freely between them. However, when I try, I get an error message. Why am I unable to move products between licenses under the same master license?
MathWorks Support Teamhttps://es.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:es.mathworks.com,2005:Question/765142013-05-21T13:34:24Z2013-05-21T13:34:24ZHDL Coder: Problems with saturation after a product block with divideHi,
I'm trying to fix my model so that it works with the HDL coder, but there is one thing i just cannot get working. I have a product block (*/), which divides the first input by the second input and after this product block is a saturation block which saturates it between -1 and 1.
When I check whether the HDL code can be generated it gives the following error:
"Error: Product block with divide input (/) only supports Saturation 'On'".
Should I remove the saturation block and force it to saturate with a matlab function file? Or what would be the best way to get this working?
Thanks in advance!
Kind Regards,
RolandRolandhttps://es.mathworks.com/matlabcentral/profile/authors/4310042-rolandtag:es.mathworks.com,2005:Question/4454532019-02-17T19:05:21Z2019-02-19T18:25:10ZIs there any way to separate the terms of a product?Hello,
Let's say I have this function_handle: f = @(x) exp(x-2)*log(x)
Is it possible to assign each function that comprises this product to its own seperate variable i.e:
g = exp()
h = x-2
j = log()
k = x
Thank you!Panagiotis Panagopoulos Papageorgiouhttps://es.mathworks.com/matlabcentral/profile/authors/14804881-panagiotis-panagopoulos-papageorgioutag:es.mathworks.com,2005:Question/1120942014-01-11T09:46:25Z2014-01-13T05:38:59ZHow to Sum a product between 0 to N-1 points.How to achieve Multiply and Addition of N discrete points from (0 to N-1) using Matlab.
For Example FFT,FIR,IIR Filters,MAC unit Shravankumar Phttps://es.mathworks.com/matlabcentral/profile/authors/4686091-shravankumar-ptag:es.mathworks.com,2005:Question/950482009-06-27T01:11:00Z2009-06-27T01:11:00ZWhy does Simulink 5.0 (R13) crash when I use the Product block with fixed point data types?When I use the Product block to perform the inverse of a matrix, I receive correct results when using doubles. If I use a fixed-point data type, I receive either a crash or an output matrix is just
equal to the input matrix.
MathWorks Support Teamhttps://es.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:es.mathworks.com,2005:Question/4690952019-06-27T01:36:13Z2019-06-27T05:37:54Zsum of multiplication for a vector and matrix Say I have the following matrix and vector:
A = [ 2,3; 1,4] b= [ 5 , 7 ]
I want a code of the sum of the multiplication, such that each element of the matrix's first row are multiplied by the 1st cell of the vector, and the elements of the matrix's second row are multiplied by the 2nd cell of the vector, as follows:
2*5+3*5+1*7+4*7
( I will need this for a 1000*1000 matrix and a 1*1000 vector, but i used this example to clarify )
Abbi Hashemhttps://es.mathworks.com/matlabcentral/profile/authors/14329853-abbi-hashemtag:es.mathworks.com,2005:Question/1009962009-06-27T01:12:00Z2009-06-27T01:12:00ZWhy do I get an error message "Error: No PolySpace product found" when downloading some results in PolySpace R2008b?When trying to download some results from Spooler GUI or using psqueue-download command from the PolySpace Client, we get the following error after the unpacking message:
ERROR:
Error: No PolySpace product found.MathWorks Support Teamhttps://es.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:es.mathworks.com,2005:Question/920072009-11-16T19:06:00Z2017-04-12T21:39:14ZWhere can I find the source code for the 3D Waterfall Plot Demo demo shown on the Data Acquisition Toolbox product page?I was wondering if the code for the waterfall plot in the product sheet of the Data Acquisiton Toolbox 2.2 (R13) is available for viewing. The file for this demo does not appear to be in the daqdemo folder.
MathWorks Support Teamhttps://es.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:es.mathworks.com,2005:Question/1020832009-06-27T01:11:00Z2009-06-27T01:11:00ZIs it possible to control the individual products and accumulators of my QFILT object with the DSP Blockset 5.0 (R13)?I can set the properties for my QFILT object for FIR and IIR filters. However, I do not have access to each accumulator and multiplier input/ output.
QFILT allows me to assign all the attributes at once. However, for optimal design, I need the internal accumulators and multipliers to be of different sizes or need them to have different rounding schemes.
For example,in my project, I need to assign attributes such as "bit width", "type of rounding" etc., to each internal accumulator and multiplier.
MathWorks Support Teamhttps://es.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:es.mathworks.com,2005:Question/942062009-06-27T01:11:00Z2017-09-26T14:51:12ZWhy is the INCLUDE line for MATLAB 6.1 (R12.1) products with multiple users not created in the MLM.opt options file?Why is the INCLUDE line for MATLAB 6.1 (R12.1) products with multiple users not created in the MLM.opt options file?
For example, I have the following license file:
# MATLAB license passcode file for use with FLEXlm 6.1g
# LicenseNo: DEMO HostID: 51f374ae
INCREMENT TMW_ARCHIVE MLM 12 01-jan-0000 0 FZXD8121223D0AC1360FG VENDOR_STRING=800000000010003 HOSTID=DEMO SN=0
INCREMENT MATLAB MLM 12 15-may-2002 4 4C4CDCVB1607F123GB1B
USER_BASED DUP_GROUP=UH SN=DEMO
INCREMENT SIMULINK MLM 12 15-may-2002 1 4DQWE1ECA294568F5846 \
USER_BASED DUP_GROUP=UH SN=DEMO
INCREMENT Curve_Fitting_Toolbox MLM 1 15-may-2002 10 \
3C6CG0FBBAQHJKW51FC7D USER_BASED DUP_GROUP=UH SN=DEMO
but my MLM.opt Options file contains:
INCLUDE SIMULINK USER username
INCLUDE Curve_Fitting_Toolbox USER username
MathWorks Support Teamhttps://es.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:es.mathworks.com,2005:Question/4208072018-09-26T08:52:15Z2019-10-04T00:48:30ZHow can I multiply each element of a cell array, defined as an anonymous function handle?I have a cell array _FS_ which contains a function handle at each cell.
I want to multiply the output of each cell with each other (giving each function handle the SAME input).
The function handles in each cell are identical except for the _i_ value stored in them.
Define array as:
N = 5;
for i=1:N
FS{i} = @(x) x+i;
end
i can obtain my desired result by a simple loop:
x = 3;
P = FS{1}(x)
for i=2:length(FS)
P = P * FS{i}(x)
end
However, I wish to define this operation as a new function handle, performing the same action:
b = @(x) FS{1}(x) * FS{2}(x) * FS{3}(x) ... * FS{N}(x)
but this should of course be flexible for any number of elements (FS). Jonas Holfelthttps://es.mathworks.com/matlabcentral/profile/authors/13482087-jonas-holfelttag:es.mathworks.com,2005:Question/3942302018-04-11T17:35:52Z2018-04-12T14:59:15ZHow to multiply every pixels?I need to find the product of every all the pixel values in a matrix. That is, if an image of size 256×256×3 is taken... i need to find the entire product of 65536 valuesSneha P Shttps://es.mathworks.com/matlabcentral/profile/authors/11992362-sneha-p-stag:es.mathworks.com,2005:Question/4150742018-08-16T08:46:51Z2018-08-16T09:30:22ZHow to sum multiple matrices?Hello, I'm new in matlab and I need some help please. I have 12 matrix s1...s12 which I want to 2 by 2 make a Kronecker tensor product of them and then sum the results. for example, I want the product of s1 and s2, s1 and s3,s1 and s4,... and then sum them all.
Thanks in advance.MohammadHossein Salimihttps://es.mathworks.com/matlabcentral/profile/authors/13304340-mohammadhossein-salimitag:es.mathworks.com,2005:Question/641072013-02-19T15:29:14Z2013-02-19T15:29:14Zusing specific columns from a constanthello all,
I have a rather large matrix (99226,40) that I load to a .mdl via From Workspace and use it as a constant input to a product. Is there a way where I can select how many of the columns I can use?
i.e. I want to see the product of X*matrix(:,1:9);
X is also a constant.
Thank you in advancetony karamphttps://es.mathworks.com/matlabcentral/profile/authors/3754467-tony-karamptag:es.mathworks.com,2005:Question/5071212020-02-23T19:22:29Z2020-02-24T18:19:31ZHow to attempt the first stage of this task?Hey guys, I currently have been set a task to achieve, but I don't know where to begin. Below is the objectives i need to achieve.
a. Fill a 1024 point array (A) with two cycles of a cosine wave. Do the same for a second array (B). Form the product of the arrays and estimate it’s integral numerically. Plot A and B and the product and add the numerical value of the integral in the plot. You should not use the symbolic toolbox for this task.
b. Repeat 3.a, this time using 20 cycles of a cosine wave for array B. comment on the result.
c. Repeat 3.a again, this time using 2 cycles of a sine wave for array B. Comment on the results.
All approaches and suggestions are welcome.
Thanks to all,
JamesJames Adamshttps://es.mathworks.com/matlabcentral/profile/authors/17578827-james-adamstag:es.mathworks.com,2005:Question/4510212019-03-19T18:00:31Z2019-03-19T18:30:35ZShort way to write this function?Hello,
Does anyone know of a solution to this problem?
function[y]=rayleigh_product(x,x2,x3,x4) % For up to 55 storm steps (threshold = 4 in the original case)
global SDSRp_ Tz_Tz_
y=(1-exp(-0.5*(x/SDSRp_(x2,x3,x4,1))^2))^(10800/Tz_Tz_(x4,2))...
*(1-exp(-0.5*(x/SDSRp_(x2,x3,x4,2))^2))^(10800/Tz_Tz_(x4,3))...
*(1-exp(-0.5*(x/SDSRp_(x2,x3,x4,3))^2))^(10800/Tz_Tz_(x4,4))...
*(1-exp(-0.5*(x/SDSRp_(x2,x3,x4,4))^2))^(10800/Tz_Tz_(x4,5))...
*(1-exp(-0.5*(x/SDSRp_(x2,x3,x4,5))^2))^(10800/Tz_Tz_(x4,6))...
*(1-exp(-0.5*(x/SDSRp_(x2,x3,x4,6))^2))^(10800/Tz_Tz_(x4,7))...
And it goes on till 55 parts. The code works now, but it would be useful to have the option of just doing the product of any number of functions. I.e, if I want to do the same analysys with a different data set.José Antonio Torreshttps://es.mathworks.com/matlabcentral/profile/authors/13395673-jose-antonio-torrestag:es.mathworks.com,2005:Question/1726602015-01-28T06:28:37Z2015-01-28T09:35:10ZHow to multiply data from cells?Hello,
Consider I have a cell array of size (1x20). I want to multiply all the elements of the cell and display it as a single output.
For eg:
X= 1 2 7 7 8 9 6 7 8 9 2 1 3 1 4 6 7 4 5 3
I want my output to be stored in a new variable say 'a'
a=1,290,482,565,120.
How do i do it? Please help. Thanks in advance.
Abiramihttps://es.mathworks.com/matlabcentral/profile/authors/5514421-abiramitag:es.mathworks.com,2005:Question/3767572017-12-15T05:00:00Z2018-01-11T20:07:19ZWhy am I getting a wrong matrix inverse when using a Math Function block set to 'pow' in Simulink?I want to calculate a matrix inverse in Simulink. For example, for matrix A = [4 0; 0 16]. I am using a Math Function block set to 'pow' to do the inverse. However, I get erroneous result as below:
A^-1 = [0.25 inf; inf 0.0625]
rather than
A^-1 = [0.25 0; 0 0.0625]
MathWorks Support Teamhttps://es.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:es.mathworks.com,2005:Question/3749372017-12-29T05:00:00Z2017-12-29T17:06:15ZWhat is the cancellation policy for Training courses?What is the cancellation policy for Training courses?
MathWorks Support Teamhttps://es.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:es.mathworks.com,2005:Question/3717142017-12-07T05:00:00Z2017-12-07T16:34:21ZHow do I enroll in any of the MathWorks training classes?How do I enroll in any of the MathWorks training classes? How do I pay for a MathWorks Training class?
MathWorks Support Teamhttps://es.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:es.mathworks.com,2005:Question/3662992016-08-17T04:00:00Z2017-11-13T18:36:07ZHow do I change the Licenses in my Master Licenses?How do I change the configuration of my Master License(s)?
MathWorks Support Teamhttps://es.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:es.mathworks.com,2005:Question/3410562017-05-19T21:49:46Z2017-05-19T22:00:56ZMultiply Each Matrix in Cell Array by a Different ValueI have a cell
A = {[1 2; 3 4]; [5 6; 7 8]};
and a vector
b = [1; 2]
and I want to multiply each matrix in A by the corresponding value in b. Is it possible to do that without loops?Alessandrohttps://es.mathworks.com/matlabcentral/profile/authors/4275258-alessandrotag:es.mathworks.com,2005:Question/1789982015-02-18T07:34:42Z2015-02-18T09:42:07ZHow to convert image array to double array?filter.*image is not working, because filter is a double array and image is an integer array. I think MATLAB should convert integer to double by default in this case, but how can I do by hand?Mr M.https://es.mathworks.com/matlabcentral/profile/authors/4980938-mr-mtag:es.mathworks.com,2005:Question/1543632014-09-11T06:27:07Z2014-09-11T06:56:34ZFigure ploting data problemHello Matlab gurus!
I have such code
if true
% code
matrix1={'1/1/2013';'2/1/2013';'3/1/2013'};
matrix2=[4;5;6];
x=datenum(matrix1);
plot(x,matrix2);
end
we get such graph
as you see on the axis it has converted time series but i want to have it original date values.
Any idea would be great help.
Waiting for your response.
<</matlabcentral/answers/uploaded_files/18026/1.PNG>>
Giorgihttps://es.mathworks.com/matlabcentral/profile/authors/5435287-giorgi