Hello,
I have the following code line:
model_soot_ratio = ref_soot + ref_soot.(exp(soot_ratio)-1);*
The problem is as follows: ref_soot is a 70*1 array and exp(soot_ratio) is a 50*1 array. Hence the elementwise matrix multiplication is not possible which is what I need.
Is there any way to increase the size of the second array by adding say NULL elements at the end so that the multiplication is valid?
I am realtively new to Matlab programming, so any suggestions to improve will be highly appreciated.
Thank You.

 채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2014년 4월 9일
편집: Azzi Abdelmalek 2014년 4월 9일

3 개 추천

A=[1 2 3 4 5 6]
B=[4 10];
B=[B zeros(1,numel(A)-numel(B))]
Or if you don't know which is the smaller
B1=[B zeros(1,numel(A)-numel(B))]
A1=[A zeros(1,numel(B)-numel(A))]

댓글 수: 1

Prakash
Prakash 2014년 4월 9일
Heyy thanks for the quick response. I tried it and now my program works.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

질문:

2014년 4월 9일

댓글:

2014년 4월 9일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by